Sudo – Differences Between sudo, su, visudo, chroot, and gksu

chrootgksususudovisudo

What are the differences between sudo, su, visudo, chroot, and gksu ?

Best Answer

  • chroot is a way of entering a folder and 'faking' that folder being / to anything executed inside. This lets you run executables on a non-booting Ubuntu installation by mounting it somewhere other than / and using /bin/bash(the one inside the installation) to get a terminal prompt.

  • sudo - Lets certain accounts authenticate to run a program as root or another user. Some programs may not need a password as defined in the sudoers file. Whether the request is allowed or not depends on the user(and group) running sudo, and the command to be run, as defined in sudoers.

  • su - Also a way of elevation, but has differences as it performs a full interactive logon as root(or another user), and gives a bash prompt unless specified otherwise with arguments. It uses the target user's credentials as authentication.

  • visudo - Edits the sudoers file. This uses a special executable that checks the syntax of the file to ensure you are not locked out of sudo due to a corrupted sudoers file. If you attempt to save an invalid configuration it will stop you, and return you to the editor to fix it.

  • gksudo or gksu is the same as sudo except it is graphical and rewrites some paths so that graphical programs do not cause permission issues on the user's profile, especially with ~/.Xauthority.