Question

Resetting and accessing Droplet password

  • Posted on December 1, 2014
  • m8fyuAsked by m8fyu

If I reset my password will this update the passwd file?

The reason that I ask is because I foolishly edited my /etc/passwd manually and in the process deleted the root user line. Now I am unable to use sudo to edit the file.

My solution is to purchase a new droplet and replicate my existing server. However I am not sure if this is truly necessary. I am fairly new to server admin, hence the foolish behaviour of manually editing my passwd file! Any info would be greatly appreciated.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

No, resetting the password updated /etc/shadow where the password is actually stored.

Follow Attempt Recovery with a Recovery ISO | How To Recover from File System Corruption Using Fsck and a Recovery ISO | DigitalOcean. You can skip the Set Up Networking in the Recovery Environment section.

Once you’ve mounted the filesystem, open /mnt/etc/passwd in nano or any other editor, and add the following line at the beginning:

root:x:0:0:root:/root:/bin/bash

Then, save the file, unmount the filesystem, and power off the droplet:

cd /
umount /mnt
poweroff

Finally, reply to the support ticket to remove the ISO image from the droplet so you can then boot your droplet normally.

This comment has been deleted