Q. How do I use FreeBSD pw command to add users?
A. The pw command 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.
Add user called tom
To add a user called tom, enter:
# pw useradd -n tom -s /bin/csh -m
# passwd tom
Where,
- -n tom : Username
- -s /bin/csh : Set shell
- -m : Create and setup home directory /home/tom
Delete a user called tom
Enter the command:
# pw userdel -n tom -r
Note that -r option remove home directory & its contents.
Getting help with pw command
For a summary of options available with each command, you can use
pw [command] help
For example, lists all available options for the useradd operation.
# pw useradd help
# man pw
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 3 comments… read them below or add one }
I found that it’s ‘pw user add name’ not ‘pw useradd name’ but thanks for the info!
er also you don’t have to use the -n switch for the user name
You can either use ‘pw useradd’ or ‘pw user add’
peace