The procedure to change the root user password on Ubuntu Linux:
- Type the following command to become root user and issue passwd:
sudo -i
passwd - OR set a password for root user in a single go:
sudo passwd root - Test it your root password by typing the following command:
su -
How to disable your root account on Ubuntu
One can disable the root account by typing the following command:
OR
Sample session from the above commands:
$ sudo passwd -dl root
OR
$ sudo passwd --delete --lock root
Sample session from the above commands:
Understanding passwd command option
- -d OR --delete : Delete a user’s password (make it empty for root user). This is a quick way to disable a password for an account. It will set the named account passwordless.
- -l OR --lock: Lock the password of the named account such as root. 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)
- root : Lock and disble root account i.e. re-disabling your root account
A note about root password on an Ubuntu server/desktop
Enabling the root account by setting the password is not needed. Almost everything you need to do as SuperUser (root) of an Ubuntu server can be done using sudo command. For example, restart apache server:
You can add additional user to sudo by typing the following command:
For example, add a user named tom to sudo:
You can in as another user say logging as tom from jerry account:
When prompted enter jerry’s password i.e. the password being asked for is your own, not tom’s. For more info see “How to create a new sudo user on Ubuntu Linux server” and RootSudo.
Source: https://www.cyberciti.biz/faq/change-root-password-ubuntu-linux/
$ sudo systemctl restart apache2
You can add additional user to sudo by typing the following command:
$ sudo adduser {userNameHere} sudo
For example, add a user named tom to sudo:
$ sudo adduser tom sudo
You can in as another user say logging as tom from jerry account:
{jerry@nixcraft}$ sudo -i -u tom
When prompted enter jerry’s password i.e. the password being asked for is your own, not tom’s. For more info see “How to create a new sudo user on Ubuntu Linux server” and RootSudo.
Source: https://www.cyberciti.biz/faq/change-root-password-ubuntu-linux/
No comments:
Post a Comment