Detailed guide to resetting password on CentOS 7 – VPTS

VPTS Team Content has been moderated
Published date:10/8/2025 Update:10/8/2025 Views:162 Reviews: 4.7/592reviews
VPTS on

In system administration or when using a VPS running CentOS 7, forgetting or losing the root account password is a fairly common situation, especially when servers are handed over...

In system administration or when using a VPS running CentOS 7, forgetting or losing the root account password is a fairly common situation, especially when servers are handed over among multiple people or left unaccessed for a long time. Losing the root password means you cannot perform critical administrative tasks, causing work interruptions or affecting operational services.

However, there is no need to worry. On CentOS 7, there is still a way to reset the root password through GRUB and emergency mode, allowing you to restore system access safely without losing data or breaking existing configurations.

In this article,VPTSwill provide step-by-step guidance to reset the root password on CentOS 7, helping you quickly regain administrative access and restore system stability.

Step 1: Access GRUB mode

  • Restart VPS/Server
  • You need to access the VNC Console of the VPS to view the boot process.
reset password
  • When the boot screen displays the menuGRUB, quickly press the keyeto enter boot command editing mode.
reset password

Step 2: Modify boot parameters

  • Move the cursor down and locate to delete"ro" 
reset password
  • And change to command"rw init=/sysroot/bin/sh"
reset password
  • Then clickCtrl + Xto boot into emergency mode.
reset password

Step 3: Remount system directory and change password

  • By default, the system will mount in moderead-only, need to switch to moderead-writeto edit:
  • Type the following key combinations and commands in sequence as shown in the image below

mount -o remount.rw /sysroot

chroot /sysroot

passwd root

touch /.autorelabel

exit

reboot
reset password
  • After resetting the password successfully, enter the commandexitto exit the current mode, then use the commandrebootto restart the system and apply changes.
  • After booting is complete, it is recommended to use SSH to log back in

See more:Reset Root Password on Ubuntu via GRUB

Note: 

  • Store your password in a safe place to avoid having to reset it.
  • If you encounter difficulties, contact the VPTS Technical Department immediately for 24/7 support.

Wishing you success in resetting your password on CentOS 7!

CONCLUSION

With the guide steps above, resetting the root password on CentOS 7 becomes quick and easy, helping you regain system access without affecting your data.
Technical teamVPTS recommends storing passwords in a secure place and setting strong passwords to ensure security.

If you encounter any difficulties during the process, contact VPTS 24/7 support immediately for timely and professional assistance.

VPTS – Comprehensive Digital Infrastructure Solutions Provider

VPTS is a digital infrastructure solution provider in Vietnam, serving deployment, operation, and data storage needs for individuals, developers, and enterprises. The service ecosystem includesVietnam VPS, International VPS, VPS Anti DDoS, Hosting cPanel, dedicated server, Rack rental, Proxy IPv4/IPv6, S3 MinIOandCloud Storage.

Besides providing infrastructure resources, VPTS also focuses on assisting customers with deployment, configuration, and practical troubleshooting. Content on the VPTS Blog is drawn from common scenarios in operating VPS, servers, and online systems, helping readers understand root causes and apply clear solutions.

VPTS – Stable infrastructure, flexible solutions, and continuous partnership throughout operations.

VPTS Team Contact Information