You are not logged in.

#1 2013-07-10 19:12:32

psycho_tea_drinker
Member
From: West Sussex, United Kingdom
Registered: 2013-07-02
Posts: 41

Accidentally deleted /etc/group and /etc/passwd

Can anybody post a copy of these for arch?

Offline

#2 2013-07-10 19:18:29

msthev
Member
Registered: 2012-04-05
Posts: 177

Re: Accidentally deleted /etc/group and /etc/passwd

https://projects.archlinux.org/svntogit … filesystem

But you don't want to do that. Look at your /etc/group- and /etc/passwd- (with dashes) — these are copies made before running {user,group}{add,mod,del}.

Offline

#3 2013-07-10 19:19:03

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Accidentally deleted /etc/group and /etc/passwd

They're part of the filesystem package... you can extract them yourself...

Or... https://projects.archlinux.org/svntogit … filesystem

Offline

#4 2013-07-10 19:19:56

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Accidentally deleted /etc/group and /etc/passwd

They're already on your computer. You can "unzip" them from "/var/cache/pacman/pkg/filesystem-*.xz".

Alternatively you can download them from here: https://projects.archlinux.org/svntogit … filesystem

Offline

#5 2013-07-10 19:26:55

psycho_tea_drinker
Member
From: West Sussex, United Kingdom
Registered: 2013-07-02
Posts: 41

Re: Accidentally deleted /etc/group and /etc/passwd

msthev wrote:

https://projects.archlinux.org/svntogit … filesystem

But you don't want to do that. Look at your /etc/group- and /etc/passwd- (with dashes) — these are copies made before running {user,group}{add,mod,del}.

I actually edited them directly due to my mistake (should have been /srv/http/etc/group for example).

Anyway thanks for your help guys.

Offline

#6 2013-07-10 19:26:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,583
Website

Re: Accidentally deleted /etc/group and /etc/passwd

They can also be regerated from the (g)shadow files, which would prevent your from having to 're-add' your user or any other changes you have made.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2013-07-11 18:29:24

psycho_tea_drinker
Member
From: West Sussex, United Kingdom
Registered: 2013-07-02
Posts: 41

Re: Accidentally deleted /etc/group and /etc/passwd

Ok I've got the files back. I added one user after installation. Should I add the user again?

Offline

#8 2013-07-11 18:35:03

psycho_tea_drinker
Member
From: West Sussex, United Kingdom
Registered: 2013-07-02
Posts: 41

Re: Accidentally deleted /etc/group and /etc/passwd

Trilby wrote:

They can also be regerated from the (g)shadow files, which would prevent your from having to 're-add' your user or any other changes you have made.

Sorry I missed your reply initially. How do I go about regenerating them from this file?

Offline

#9 2013-07-11 19:17:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,583
Website

Re: Accidentally deleted /etc/group and /etc/passwd

`man pwcongv`

EDIT: upon rechecking I'm not sure if these tools actualy work in the needed direction: they can regenerate (g)shadow from passwd/group, I was under the impression they can do the opposite conversion as well, but I'm not too sure now that I reread the man page.

Last edited by Trilby (2013-07-11 19:20:40)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2013-07-11 19:35:56

progandy
Member
Registered: 2012-05-17
Posts: 5,211

Re: Accidentally deleted /etc/group and /etc/passwd

Trilby wrote:

`man pwcongv`

EDIT: upon rechecking I'm not sure if these tools actualy work in the needed direction: they can regenerate (g)shadow from passwd/group, I was under the impression they can do the opposite conversion as well, but I'm not too sure now that I reread the man page.

You cannot really recreate them. shadow contains only the username and some passwordinfo, not shell, homedir and also no gids and uids.

The only way to really get to the old state is to use the backup (/etc/group-  /etc/gshadow-  /etc/passwd-  /etc/shadow-) or extract the original files and readd all users with their userids manually.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#11 2013-07-19 14:07:09

jackbenny
Member
Registered: 2013-07-19
Posts: 3

Re: Accidentally deleted /etc/group and /etc/passwd

Just a small tip for the future, since I have done the exact same thing as you did once. Keep your /etc in a git repo, that way you can easily revert any changes or accidentally deleted files. Just remeber to "chmod 700 .git" so that regular users on your system can't get hold of your shadow file.

Offline

Board footer

Powered by FluxBB