Changing the passwd file to reset password on Raspbian

2.1k views Asked by At

I'm trying to reset the password of my Raspberry Pi 2 B running Raspbian, and I thought I could do this by mounting the sd card on my Ubuntu PC and change the shadow file for the pi user from

pi:[hash]: [...]

to

pi:*: [...]

in order to signify that my user doesn't have a password in shadow, just as it looks in Ubuntu when I remove my account's password with

sudo passwd my_user -d

However it didn't work and now I see I have on my Raspberry pi in /etc/ 2 passwd files and 2 shadow files: my modified files of passwd and shadow and a passwd- and shadow- file that seem to be the file versions, before I changed them.

Can someone please explain to me why this is happening? I'm more curious than frustrated with this.

1

There are 1 answers

1
umläute On

whenever you run passwd to modify the shadow-database (which consists of the files /etc/passwd and /etc/shadow) it is making automatic backups of these files. the backups have - appended to the filename.

this is also true for other files managed by the same set of tools, e.g. /etc/group..

this is normal.