Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I thought "sudo -s" was the correct way to drop into a root user shell.


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
    $




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: