Pages

Selasa, 19 November 2013

Pfsense/FreeBSD add a user to group

Pfsense/FreeBSD add a user to group

Task: Add existing user to group

You would like to add existing user tom to secondary group called ftpusers. Type the command as follows:
# pw usermod tom -G ftpusers
You can add tom to secondary group ftpuser and wwwusers:
# pw usermod tom -G ftpusers,wwwusers
-G option Set the default groups in which new users are granted membership. This is a separate set of groups from the primary group, and you should avoid nominating the same group as both primary and extra groups.

Task: Add a new user to group

Add new user jerry to system and to secondary group sales:
# pw useradd jerry -G sales
# passwd jerry

First command adds user jerry to secondary group called sales. Second commands set a password for jerry.
 

Task: Print list of users and groups

awk -F":" '{print $1}' /etc/passwd 
awk -F":" '{print $1}' /etc/group

Tidak ada komentar:

Posting Komentar