root shell
Thilo Six
T.Six at gmx.de
Sat Oct 6 17:21:20 UTC 2007
Derek Broughton wrote the following on 05.10.2007 23:37
<<-snip->>
> OK, don't listen then. sudo -i is NOT the same as sudo su.
In 'usuall' Linux-Systems you use 'su -' to gain root privileges WITH the
environment configured for root (e.g. /root/.bashrc).
man su:
<-----------------------------------------------------
-, -l, --login
Provide an environment similar to what the user would expect had
the user logged in directly.
----------------------------------------------------->
so 'sudo -i' is the equivalent in sudo driven systems.
man sudo.
<-----------------------------------------------------
-i The -i (simulate initial login) option runs the shell specified in
the passwd(5) entry of the user that the command is being run as.
The command name argument given to the shell begins with a - to
tell the shell to run as a login shell. sudo attempts to change
to that user's home directory before running the shell. It also
initializes the environment, leaving TERM unchanged, setting HOME,
SHELL, USER, LOGNAME, and PATH, and unsetting all other
environment variables.
----------------------------------------------------->
It´s not possible (as it seems) to use aliases (aka shortcuts) with sudo.
But if you login as root with 'sudo -i' all your aliases configured for root
will work (/root/.bashrc is read).
Long story short:
> Try: sudo -i
> which is the "correct" way to get a root shell.
bye
--
Thilo
key: 0x4A411E09
More information about the ubuntu-users
mailing list