News for hackers. Stuff that matters.
Re:The Meaning of 'su' by ralph on Monday February 25, 2013 @04:40AM (#5278083)
No, unless one understands the subtleties, it may be best to use -i.

    $ sudo -s
    $ pwd
    /home/ralph
    $ exit
    $ sudo -i
    root@orac:~# pwd
    /root
    root@orac:~# logout
    $
    $ sudo strace -fe execve sudo -s
    execve("/usr/bin/sudo", ["sudo", "-s"], [/* 16 vars */]) = 0
    execve("/bin/bash", ["/bin/bash"], [/* 16 vars */]) = 0
    ...
    $ exit
    $ sudo strace -fe execve sudo -i
    execve("/usr/bin/sudo", ["sudo", "-i"], [/* 16 vars */]) = 0
    execve("/bin/bash", ["-bash"], [/* 16 vars */]) = 0
    ...
    root@orac:~# logout
    $

There are no comments on this comment yet.