Change Root Passwd In Ubuntu-Server-25.01 And Switch Accounts

To change the root password on an Ubuntu server,

 log in with a user that has sudo privileges and run 

sudo passwd root

 You will be prompted to enter your current user password, followed by the new password for the root account. 

names.co.uk

Jul 18, 2021

 Steps to Change Root Password:

 Log in to your Ubuntu server via SSH or the terminal.

Run the command:

bash

sudo passwd root

Enter your password:

 Type your current user's password when prompted.

 Enter the new password:

 Type the new root password, then re-type it to confirm.

Optional: 

 If you want to lock the root account again after setting the password, you can use

 sudo passwd -l root

names.co.uk
 
Alternative Scenarios:

 If you are already logged in as root:

 You can simply type

 passwd

 If you forgot the root password:

 You must restart the server, access the GRUB menu, and enter recovery mode to reset it. 

names.co.uk

Switch accounts on Ubuntu server 

Switch accounts

su -

For root, and,

to login as user account:

su - ExampleUserName

To login to the

ExampleUserName

Server user account?!!  

YES that's how you switch from accounts on a Ubuntu server. 

This version I am pretty sure:

 Ubuntu Server 25.01

Comments

Popular Posts