A basic observation regarding the "su" and "sudo" commands ( for beginners ).

Russell

Active Member
Joined
Jul 21, 2018
Messages
28
Attention: windowsForum users:
When you are using the "su" command at the Debian version 9.5 Linux prompt, you must use your root password. When you are using the "sudo" command, you must use your user password. If you use your root password for the "sudo" command, you will get a few retries to enter the correct password, and then you will receive the following error message ( if you fail to enter the correct password ):

"User <username> is not in the sudoers file. This incident will be reported."

Try not to get confused when to use the root password and when to use the user password. Keep in touch.:)

Sincerely in Christ,
Russell E. Willis
P.S. - Please read Proverbs 23:23.
Holy_Bible_RSV_2_crop (692x687).webp

"23 Buy truth, and do not sell it; buy wisdom, instruction, and understanding."
[ Proverbs 23:23; RSV ]

Russell E. Willis
3559 Almanac Road
Tallahassee, Florida 32309
 


Last edited:
Solution
No not really. Sudo, provided your user is in the sudoer file allows you to temporarily elevate the rights of that user. SU switches the user context your running in. SU doesn't elevate your rights unless you switch to the root user provided it's enabled (root isn't always enabled such as the case with Ubuntu.
su actually stands for "substitute user" so su without a user will switch to the superuser aka root or you can supply a user name along with su and switch to that users context.
 


Just out of curiosity, I threw a su command in terminal and found that you must give the PW when you type the command. Where as Sudo, asks you AFTER the command.

Which begs the question, in theory, they are essentially the same?
 


No not really. Sudo, provided your user is in the sudoer file allows you to temporarily elevate the rights of that user. SU switches the user context your running in. SU doesn't elevate your rights unless you switch to the root user provided it's enabled (root isn't always enabled such as the case with Ubuntu.
 


Solution
I think that's smart. having to type in my PW when installing apps is fine. I just sudo all the time. Go with what you know I guess
 


With su you can use any command as a superuser. With sudo you have to use the password everytime for every command suffix that needs a sudo prefix.
 


Back
Top