Skip to content

I overwrote /etc/shadow... how do I recover from this?

Well, I (stupidly) let yay overwrite the /etc/shadow file and now I can’t login. How do I proceed to get my computer working again?

E: that was... easier than I expected. I just followed these steps from the wiki. That seems insecure but hey it works I guess.

Edited 13 May 2020. We only hold this version.

5 points12 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
5 · 100% up
Kind
Text
ID
gioyqa

Author

17
posts
97
comments
6
media
View profile

13 comments

unknown author1 hidden

Deleted before we saved it.

4 points

Ah thank you! You were right that I was missing them but the backup helped :)

1 points

If someone has physical access to your unencrypted machine, it is not safe. This is what full disk encryption is for.

2 points

Makes sense, thanks! I’m going to try setting up full disk encryption next week but I’ve been waiting for my semester to end just in case I mess anything up.

1 points

Very good thought, I would also not do any system updates. I once was screwed over by a reboot. Not gonna do that again if I need the machine to work in the next few hours.

2 points
unknown author1 hidden

Boot arch install media, chroot into your old install and change your password

2 points

Thanks! I realized you commented right as I edited my post, so I didn't actually see you reply before. I ended up just following the password recovery steps from the wiki with appending init=/bin/bash to my grub entry and using passwd to change the password, since I don't have full-disk encryption right now.

2 points

And all that because Mr Poettering suggested to set an invalid root password instead of an empty one in the default shadow file that's installed by the filesystem package ;). Bashing incoming in... https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/filesystem&id=0320c909f3867d47576083e853543bab1705185b

-1 points

really? so you're saying that what he proposed overwrote the /etc/shadows for this dude? what about rest of the arch users? didn't happen to me...

2 points

No, pacman notices this and installs it as shadow.pacnew but his "helper" overwrote it because he told it to do so. I wrote this comment rather as an explanation why this file had to be updated in the first place (and this was not an accusation in any way, this fix is important if you create a user account during installation directly in the chroot and forget to do a "passwd root" before you reboot; you don't want that passwordless root account).

Edit: There's a post about it: https://www.reddit.com/r/archlinux/comments/giue3c/default_root_login/

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.