I've just used "sudo passwd" instead of "passwd" on a system by mistake and I'm wondering what the affect of this would be. There are two users on the system, my user account which has sudo privileges and another with sudo privileges belonging to the server administrator. The system does not have a root account so I am wondering what exactly has been changed by using that command. When I executed it it prompted for new password which I gave and confirmation of that. Following that there was no further output.
-
Does one of those two accounts have UID 0? – Chris S Apr 18 '11 at 17:21
-
To reverse the change you made you and return the system to the standard setup you can use the command `sudo usermod -p '*' root`. – Zoredache Apr 18 '11 at 17:35
-
You're subject is a fallacy. All linux systems have root accounts. You might not be allowed to use it as a standard user account, but the system itself has one because that's what the kernel and other low level things run as. – Caleb Apr 18 '11 at 18:48
4 Answers
Ubuntu does have a root user account. You just enabled it. To test this, try logging in as root and giving the password you just created at the prompt. You will be logged in as root.
- 1,553
- 3
- 11
- 10
-
3@TiZon, My Ubuntu 10.04 system with a stock sshd_config has `PermitRootLogin yes`. As soon as you change change the root password, you will be able to login as root via SSH. Even with a disabled root account you can login as root via an SSH key with the stock config. – Zoredache Apr 18 '11 at 17:34
In a Linux system... there is always a root account. Most of the time it is configured to prevent users from logging in as root, but it still exists. "sudo passwd" will set a password for the user root. In some cases, this will do nothing, as root is not permitted to login. In others, it will actually enable the root account for login. (depending on the system's configuration and how the root-account was disabled)
- 7,349
- 16
- 23
Are you sure there is no root account? Is there not a root row in /etc/passwd? I imagine passwd would complain if you try to set a password on a user that does not exist. I think there is a root user and you just set that user's password. You probably want to remove the password again using passwd -d.
- 2,970
- 2
- 21
- 27
The effect is now you can run su
.
Every linux distro has a root
account, while some just disabled login for root
, for security concerns.
See Is "sudo su -" considered a bad practice? for more information.
In short, sudo
is logged while sudo su
isn't. When you run su
, you use your root password (set by sudo passwd
), while you sudo, you use your account's password.
- 15
- 9