Why doesn't sudo read /root/profile?
NoOp
glgxg at sbcglobal.net
Fri Dec 18 18:10:52 UTC 2009
On 12/17/2009 08:28 AM, Markus Schönhaber wrote:
> 17.12.2009 16:56, Rick Morneau:
>
>> Whenever I "sudo" or "sudo su root", my PATH variable is
>> some kind of minimal default instead of what's specified in
>> /root/.profile. Is there some way to provide a real root
>> environment when using "sudo"?
>
> sudo -i
>
> from man sudo:
>
> | -i [command]
> | The -i (simulate initial login) option runs the shell
> | specified in the passwd(5) entry of the target user as
> | a login shell. This means that login-specific
> | resource files such as .profile or .login will be read
> | by the shell. If a command is specified, it is passed
> | to the shell for execution. Otherwise, an interactive
> | shell is executed. sudo attempts to change to that
> | user's home directory before running the shell. It
> | also initializes the environment, leaving DISPLAY and
> | TERM unchanged, setting HOME, SHELL, USER, LOGNAME,
> | and PATH, as well as the contents of /etc/environment
> | on Linux and AIX systems. All other environment
> | variables are removed.
>
And: https://help.ubuntu.com/community/RootSudo
might also be of use.
More information about the ubuntu-users
mailing list