Interview Prep/Linux/Permissions, Users & sudo

What is the difference between `sudo -i`, `sudo -s` and `sudo su -`?

IntermediateConceptPermissions, Users & sudo
Answer
  • sudo -i: root login shell, root's environment and home, reads root's profile.
  • sudo -s: root shell keeping much of your environment (and your current directory).
  • sudo su -: works like sudo -i but chains two programs; logs only "su" in sudo's log.

Prefer running individual commands with sudo so each is logged.

All Linux questions Roadmap: Linux

More on Permissions, Users & sudo