# user managment



## RUMMY (Jul 12, 2009)

how can I backup users and groups and then restore


----------



## SirDice (Jul 12, 2009)

Backup /etc/passwd and /etc/pwd.db.


----------



## RUMMY (Jul 12, 2009)

need I /etc/master.passwd /etc/group /home/* /var/mail/* ?


----------



## dennylin93 (Jul 12, 2009)

The file that saves the group is /etc/group. Since /etc/passwd is a shadowed version of /etc/master.passwd, is only shows "*" in place of the password hashes.

The directories under /home contain the files of users, and /var/mail contains the mail. Information such as groups, passwords, and usernames aren't saved in these directories, but sometimes there's important stuff you might want to backup.


----------



## RUMMY (Jul 12, 2009)

dennylin93 said:
			
		

> The file that saves the group is /etc/group. Since /etc/passwd is a shadowed version of /etc/master.passwd, is only shows "*" in place of the password hashes.
> 
> The directories under /home contain the files of users, and /var/mail contains the mail. Information such as groups, passwords, and usernames aren't saved in these directories, but sometimes there's important stuff you might want to backup.



so how can I fully backup my users and than restore?


----------



## vivek (Jul 12, 2009)

RUMMY said:
			
		

> so how can I fully backup my users and than restore?



Use dump and restore command to backup /etc, /home, /var etc directory. If you just need those files use tar:

```
tar -cvf /path/to/backup.tar /etc/passwd /etc/master.passwd /etc/blah /home/you /home/me /var/mail
```
To restore use tar again:

```
cd /
tar -xvf /path/to/backup.tar
```
To get only /etc/passwd 

```
tar -xvf /path/to/backup.tar /etc/passwd /etc/master.passwd  /etc/group
```


----------



## RUMMY (Jul 12, 2009)

I tried but not works, as I see whit that files I cant manage users. so how can I do that?


----------



## dennylin93 (Jul 15, 2009)

I don't really understand your previous post, but you have to be root in order to do these backups. Use `$ su` or `$ sudo su` to gain the proper permissions. The latter requires security/sudo.

There's also a nice howto about backups here: https://forums.freebsd.org/showthread.php?t=185


----------

