Réinitialiser un mot de passe Linux perdu ou oublié !
2 min read
19 hours ago
Published on Jan 29, 2025
This response is partially generated with the help of AI. It may contain inaccuracies.
Table of Contents
Introduction
This tutorial will guide you through the process of resetting a lost or forgotten password on a Linux system. Whether you're using Fedora, Ubuntu, or another distribution, these steps will help you regain access to your account.
Step 1: Understand Installation Types
- Be aware that if your Linux installation is encrypted, the steps may vary slightly.
- Ensure you have physical access to the machine, as these steps require you to reboot the system.
Step 2: Restart and Access GRUB
- Restart your computer.
- As the system is booting, you may need to access the GRUB menu:
- If GRUB does not appear, try pressing the Shift key repeatedly during startup.
Step 3: Edit the GRUB Entry
- In the GRUB menu, highlight the entry for your Linux installation.
- Press the 'e' key to edit the boot parameters.
- Locate the line that starts with "linux" or "linux16."
Step 4: Modify Boot Parameters
- Append the following at the end of that line:
init=/bin/bash
- This modification allows you to access a root shell.
Step 5: Boot into the System
- After modifying the line, press Ctrl + X or F10 to boot with the new parameters.
Step 6: Remount the Root Filesystem
- Once the system has booted, you will be in a minimal shell.
- To change the password, you need to remount the root filesystem with read-write permissions:
mount -o remount,rw /
Step 7: Change the User Password
- Use the following command to change the password for your user account:
Replacepasswd username
username
with your actual username. - Enter the new password when prompted.
Step 8: Prepare to Reboot
- Before rebooting, unmount the root filesystem to avoid issues:
mount -o remount,ro /
- Reboot the system using:
Alternatively, you can use Ctrl + Alt + Del to reboot.exec /sbin/init
Conclusion
You should now be able to log into your Linux system with the new password. If you encounter issues with GRUB not displaying during boot, try the Shift key or consult your distribution's documentation for troubleshooting. Remember to keep your passwords secure and consider using a password manager for future reference.