0

su manual

http://manpages.ubuntu.com/manpages/precise/man1/su.1.html

The current environment is passed to the new shell.

Obviously you cant use su in Ubuntu as in su but it has to be always sudo susince the root user is disabled in Ubuntu but it seems this changes the abilities of the su command.

Any explanation?

Xen2050
  • 8,705
Hinklo
  • 626

2 Answers2

4

I think I read somewhere that sudo does not pass along all environment variables on purpose, since that could be used to introduce root exploits (not unlike the recent bash bugs). Or you may need to use sudo with -E

 -E, --preserve-env
             Indicates to the security policy that the user wishes to pre‐
             serve their existing environment variables.  The security
             policy may return an error if the user does not have permis‐
             sion to preserve the environment.

So you may have a different "security policy" set, somewhere. man sudo has more info, it appears to have more settings than just su does.

Xen2050
  • 8,705
0

You can use su directly if you have enabled the root user by setting a password for the same.

This can be done with the command

sudo passwd root