Originally Posted by
wavestar
Hello, I'm actually a Debian user, but my A+ book uses ubuntu in their example, and I wanted to verify the accuracy of their statements. I've found many errors in these Sybex books.
Firstly
The book says, "In some distos, such as Ubuntu, you must use the sudo command because you don't get to set up a root user when you install." The book then goes onto say, "If you are listed as an authorized user in the sudoers file, sudo executes the command."
The problem I have with this is, you need to be root to add a user to the sudoers file to give sudo it's power. Is this not so? I'm not new to adding users to the sudoers file, but how can a standard user add someone if there is no root account on the system?
I see why this statement is a little bit misleading. What the author wants to say is that during installation you are not prompted to set up a root password. The root account is ("created" and) configured in a very similar way like in any other major distros. The difference is that the root account password is locked.
If you check out the /etc/shadow file you will see an exclamation mark (!) in the place of the encrypted password. This is a very common way to lock a user's password.
This simply means that you can't use a password to authenticate as root. The account is not disabled!
From man passwd:
Code:
-l, --lock
Lock the password of the named account. This option disables a
password by changing it to a value which matches no possible
encrypted value (it adds a '!' at the beginning of the password).
Note that this does not disable the account. The user may still be
able to login using another authentication token (e.g. an SSH key).
To disable the account, administrators should use usermod
--expiredate 1 (this set the account's expire date to Jan 2, 1970).
Users with a locked password are not allowed to change their
password.
If you check out the default sudoers file you will see that users from the admin and sudo groups are allowed to run any command as another user or root. The first user created during installation is added automatically to the admin group. In this way, it has full sudo rights.
Originally Posted by
wavestar
The second question is, the book says, "if you enter su without any arguments, it starts a new shell, but if you enter su - (with the hyphen), before your command you stay in the same shell." Is this true?
I don't understand this statement. What command they are talking about?
The man page of su is very clear. su starts an interactive shell and su - a login shell.
Originally Posted by
wavestar
Lastly they are saying that, "when you run sudo, you're running as another user, usually root." But I would say, sudo is more of an elevated power user, It's NOT as powerful as root unless the root user gives a sudo user full power.
Both sudo and su are setuid root applications. They allow a specific set of users to run a command or shell as another user or root. The main difference is that by default sudo asks for the invoking user's password and su prompts you for the target user's password.
For more details please check out: https://help.ubuntu.com/community/RootSudo
Bookmarks