This isn’t a question but I did notice (in the archives) someone was trying to use sudo instead of su to run a command and they kept getting a ‘command not found’. I figured that this is a common new linux user question.
The sudo can be used as a ‘temporary root’, “sudo allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file. The ‘sudo’ requires that users authenticate themselves with a password by default, after issuing the command (if it requires a root password). Once a user has been authenticated, a timestamp is updated and the user may then use sudo without a password for a short period of time (5 minutes unless overridden in sudoers)”.
(yes, I ‘borrowed’ the definition from man but I shortened it a bit) :shame:
Su on the other hand, called as in ‘su [ENTER]’, and requires the user to know and type the root password before allowing the user to do anything. It will allow the user an indefinite period of time to do whatever they want or need to do. To exit the ‘su’ command, after the user is done, they simply need to type at the prompt, ‘exit’ (without the '). (‘man’ definition: Change the effective user id and group id to that of USER. So you see, it’s not used just to get root privaleges). Then, to close the terminal, type ‘exit’ again (or just simply right-click the [X] at the upper right-hand corner (or left-hand corner, as the case may be) and close the terminal without having to type ‘exit’ at all).
Example:
user_name@linux:~> su
Password: _
At the ‘Password: _’ prompt, the user enters the root password to gain access to root permissions. One could also type: ‘su root’ or ‘su username’ to get that users’ privalege or access.
Sudo will not allow a normal user (non-root or system administrator [also known as 'default user, the first user when the system was installed]) to run any command that would change
(or alter) the system without root access.
If this is confusing to some people, try (in a terminal) ‘man su’ and/or ‘man sudo’ (without the ') for a more complete description of each call.
If I am wrong anywhere or left something out, I will graciously accept being corrected.
QBall