On Monday 31 March 2003 10:54, William Hubbs wrote:
> Hi all,
>
> is there a way to get sudo to run a shell with the -s option as a login
> shell? I ask because when I give the command
>
> sudo -s
>
> and enter a password, I become root, but not with root's environment, so
> /sbin, /usr/sbin, etc, are not in the path.
>

sudo sh --login
(-l [DASH EL] is a synonym for --login)

This will cause sh to source ~/.bash_profile or ~/.profile, etc. and set up 
your environment. 


On my systems, I've set an alias:

alias sudo='sudo -H'

The -H option sets $HOME to the target user's home path. This is important 
when running programs that might create root-owned settings files in your 
$HOME directory tree (Midnight Commander in particular).


-- 
D. Wollmann
gpg 58A7 2C9A FCBC 8B4A 6F76  1BF1 9BE0 FB93 34C8 8A21

Attachment: pgp00000.pgp
Description: signature

Reply via email to