Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Reset Forgotten Root Password in Ubuntu

    Reset Forgotten Root Password in Ubuntu

    June 18, 2024

    It’s only human to forget passwords, especially if you are not using it frequently.

    It happens with Ubuntu, Linux, or any other operating system you use. If you don’t use it frequently, you are likely to forget the password.

    I have written about resetting forgotten Ubuntu passwords in the past. It works flawlessly unless you have a root password set.

    In this tutorial, I’ll show you how to set a new root password if you forget the original one.

    Resetting the forgotten root password

    ✋
    This scenario only works when you have root password set up (do not confuse it with the default admin account with sudo access) and you have physical access to the system.

    First thing first, I am talking about the case where you have explicitly set a root password.

    Let me recall things around the root user in Ubuntu.

    When you install Ubuntu, you create a user account. This user account has admin access to install and remove software and do all the other administrative tasks with elevated access thanks to the sudo mechanism.

    By default, the root account doesn’t have a password. You use sudo with your main/admin account to do things as root. However, some people explicitly set a root password.

    And this creates a problem when you try to reset forgotten password using the recovery shell as described in this tutorial. You’ll see this error:

    Give root password for maintenance

    Let me show you how to bypass this error and reset the root password.

    Step 1: Go to the recovery mode from Grub screen

    When you power on the system, it shows up the grub screen that gives you different options to enter Ubuntu, recovery mode or access UEFI settings.

    In here, you use the arrow key to select the Advanced options for Ubuntu:

    💡
    If you don’t see the grub screen, press and hold the Shift key as your system boots.

    On the next screen, you should see the available kernel options with their respective recovery mode. You can choose the first entry that has recovery mode in it:

    Step 2: Use dpkg package repair option

    The recovery mode gives you various choices. What you need to do here is to go to dpkg Repair broken packages option.

    Press tab key to go to OK and then press enter to confirm your choice.

    Press Yes when you see this next screen:

    ⚠️ Important step now

    It will update the package cache and ask you if you want to upgrade. You have to enter d here for details.

    Enter d for details

    While it gives you package details, you get access to write something on the screen here. You have to write:

    !/bin/bashAccess root shell in Ubuntu

    Press enter and you’ll be in the root shell. That’s a good thing 😄

    Step 3: Reset root password from the root shell

    Now, you are using the shell as root user. You don’t know the password, so the next step is to use the passwd command and reset its password:

    passwd

    You’ll be asked to enter the password and then repeat the same password.

    📋
    Nothing is displayed on the screen when you type the password. That’s normal. Just type the password and press enter.

    If you see the ‘you ‘, you have fulfilled your mission.

    Now to exit this screen, enter the reboot command:

    reboot

    Conclusion

    And that’s it. You have successfully used local privilege escalation to reset the forgotten root password in Ubuntu. Enjoy 😄

    Sorry for the poor screenshots. I took it from an actual bare metal system while testing this scenario. As long as you can follow the steps, it should be fine, right?

    Source: Read More

    Hostinger
    Facebook Twitter Reddit Email Copy Link
    Previous ArticlePreventative defense tactics in the real world
    Next Article 10 AI-based Search Engines I Tested Recently

    Related Posts

    Machine Learning

    LLMs Struggle with Real Conversations: Microsoft and Salesforce Researchers Reveal a 39% Performance Drop in Multi-Turn Underspecified Tasks

    May 17, 2025
    Machine Learning

    This AI paper from DeepSeek-AI Explores How DeepSeek-V3 Delivers High-Performance Language Modeling by Minimizing Hardware Overhead and Maximizing Computational Efficiency

    May 17, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    How Cisco accelerated the use of generative AI with Amazon SageMaker Inference

    Development

    CrowdStrike Warns of Phishing Scam Targeting Job Seekers with XMRig Cryptominer

    Development

    Google Chrome on mobile launches trending searches, more. Edge now has catching up to do

    Development

    CVE-2025-32704 – Microsoft Office Excel Buffer Over-read Remote Code Execution Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    Development

    Chrome Vulnerability Alert: Google’s Rapid Response to 6th Zero-Day Exploit

    May 15, 2024

    A new Google Chrome vulnerability has been uncovered and exploited, marking the sixth zero-day incident…

    Essential Photoshop Brushes for Drawing

    July 26, 2024

    Japan Considers Measures To Mandate Private Sector Cybersecurity Incident Reporting

    August 6, 2024

    Carolina Cansino Leads with a People-First Mindset

    April 29, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.