Posts for the month of November 2010

sudo: sorry, you must have a tty to run sudo

Ran into this the other day at work on RHEL5. Unfortunately, net searches come up with a not-so-great answer - "just comment out Defaults requiretty." Don't you think it's there for a reason?

The reason is that without having TTY control characters interpreted, unless you are using the "NOPASSWD" option, sudo cannot mask out your password and it will be printed to your screen for all to see!

The simplest (and most proper IMHO) work-around is to simply use "ssh -t" instead of "ssh" in your command line that is calling sudo on the remote machine.

Screen

Screen is a useful tool when remoting into a Unix box. It's been around forever, and I'm just going to document the .screenrc that I use here:

altscreen
autodetach on
hardstatus alwayslastline "%{= bY}%3n %t%? @%u%?%? [%h]%?%=%c"
vbell on
startup_message off
pow_detach_msg "Screen session of $LOGNAME $:cr:$:nl:ended."
defscrollback 10000
nethack on
zmodem off
caption always '%{= bY}%-Lw%{= bm}%50>%n%f %t%{-}%+Lw%<'
dinfo
fit
defmonitor on
verbose on