How to reset Root password on Ubuntu 17.04 if forgotten

12/02/2020

This is a howto tutorial on how to reset root password on Ubuntu 17.04 via Grub. Please note that its assumed that you have physical access to the machine in question, it cannot be done remotely. Before we proceed, lets take a quick look at what Grub is about.

What is GNU GRUB?

GNU GRUB as described here, is a Multiboot boot loader. It was derived from GRUB, the GRand Unified Bootloader, which was originally designed and implemented by Erich Stefan Boleyn.

Briefly, a boot loader is the first software program that runs when a computer starts. It is responsible for loading and transferring control to the operating system kernel software (such as the Hurd or Linux). The kernel, in turn, initializes the rest of the operating system (e.g. GNU).

Reset Root Password

  • The first thing we need to do is reboot the Ubuntu 17.04 machine. While the system is rebooting, you need to press the SHIFT key on your keyboard immediately to take you to the GNU GRUB menu screen

reset root password

  • Next select the default boot OS which in my case is Ubuntu and pess the “e” key to enter the edit screen

reset root password

  • On the GNU GRUB edit mode screen, use the arrow buttons and locate the line that starts with “linux”. Usually this would be towards the end of the screen. All you need to do is locate the section that reads “ro quiet splash $vt_handoff” and change it to “rw init=/bin/bash”. See the screenshots below before and after change

Before Change

linux              /boot/vmlinuz-4.10.0-20-generic root=UUID=935da898-
3af3-469a-bacf-21164ca3efc9  rw quiet splash $vt_handoff

reset root password

After Change

linux              /boot/vmlinuz-4.10.0-20-generic root=UUID=935da898-
3af3-469a-bacf-21164ca3efc9  rw init=/bin/bash

reset root password

  • When done, press CTRL+x or F10 to reboot the system
  • The system will boot to a root shell command prompt screen. First lets check that your partition is in the read-write state by running the following command
root@(none):/# mount | grep -w /

reset root password

  • To reset the root password, type “passwd” and follow the prompt to complete the change

reset root password

  • Now that the root password had been changed successfully, reboot your machine with following command
root@(none):/# exec /sbin/init

If you run into any change while carrying out this steps, please feel free to drop a comment of the challenge and we will do our our to provide a fix

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Cách mở Port Remote Access MySQL trên centos và ubuntu

Hướng dẫn kích hoạt Remote Access MySQL 1. Thay đổi cấu hình MySQL ***Lưu ý: bước này không cần làm...
14/01/2021

Installing NIS server on Ubuntu 18.04 LTS

The full form of NIS is Network Information Server. NIS server stores all the user information in a database. NIS client...
29/12/2020

How to Install MenuLibre – Ubuntu Menu Editor on Ubuntu, Linux Mint

MenuLibre is an advanced menu editor that provides modern features in a clean, easy-to-use interface. In a nutshell, it enables...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

SỰ KHÁC BIỆT GIỮA RESIDENTIAL PROXY VÀ PROXY DATACENTER
17/02/2024

Mua Proxy v6 US Private chạy PRE, Face, Insta, Gmail
07/01/2024

Mua shadowsocks và hướng dẫn sữ dụng trên window
05/01/2024

Tại sao Proxy Socks lại được ưa chuộng hơn Proxy HTTP?
04/01/2024

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo
02/01/2024