You are in: > Home > Systems Administration
FreeBSD : Adding users and groups
The pw utility is a command-line based editor for the system user and group files, allowing the superuser an easy to use and standardized way of adding, modifying and removing users and groups. Note that pw only operates on the local user and group files. NIS users and groups must be maintained on the NIS server. The pw utility handles updating the passwd, master.passwd, group and the secure and insecure password data base files, and must be run as root.
The first one or two keywords provided to pw on the command line provide the context for the remainder of the arguments. The keywords user and group may be combined with add, del, mod, show, or next in any order. (For example, showuser, usershow, show user, and user show all mean the same thing.)
This flexibility is useful for interactive scripts calling pw for user and group database manipulation. Following these keywords, you may optionally specify the user or group name or numeric id as an alternative to using the -n name, -u uid, -g gid options.
Adding a new group
For example, to add a new group to your FreeBSD system you should run the following command:
pw add group $GROUPNAME
Replacing $GROUPNAME with the desired name of your new group
Adding a new user
The next thing you will probably want to do is to add a new user to your system, into the group you have just created. Again, this can be done using the pw command.
For example, say we had called the new group admins, and wanted to add a user called lee into this group, specifying that he should use the csh shell by default we could do the following:
pw useradd lee -c "Lee S" -d /home/lee -g admins -m -s csh
Related articles
- SSH Tunnels - [18th Feb 2008]
- FreeBSD : Adding fortunes to appear after MOTD - [03rd May 2007]
- FreeBSD : Adding users and groups - [03rd May 2007]
- Linux File Permissions - [05th Jan 2006]
- System Administration Tasks - [16th Dec 2005]
- Systems Adminstrators Knowledge - [16th Dec 2005]
- Managing Hardware and Software - [16th Dec 2005]
- Users - [16th Dec 2005]
- Systems Administration Introduction - [16th Dec 2005]







