How to edit /etc/shadow file?

QuestionsQuestions8 SkillsProUser Account ManagementNov, 17 2025
0222

To edit the /etc/shadow file, you need superuser (root) privileges because it is a sensitive file. Here’s how you can do it:

  1. Open the file with a text editor using sudo. You can use editors like nano, vim, or vi. Here’s an example using nano:
sudo nano /etc/shadow

Or using vim:

sudo vim /etc/shadow
  1. Make your changes. Be very careful when editing this file, as incorrect modifications can lock users out or compromise system security.

  2. Save your changes:

    • In nano, press CTRL + O to save, then CTRL + X to exit.
    • In vim, press ESC, type :wq, and then press Enter to save and exit.
  3. Verify your changes (optional). After editing, you can view the file again to ensure your changes were applied correctly:

sudo cat /etc/shadow

Important Note: Editing the /etc/shadow file can have serious implications for system security and user access. Always ensure you have a backup and understand the changes you are making.

0 Comments

no data
Be the first to share your comment!