≡ Menu

FreeBSD pw command examples

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

Sysadmin because even developers need heroes!!!

Share this tutorial on:
{ 3 comments… add one }
  • Robert October 2, 2007, 8:17 am

    I found that it’s ‘pw user add name’ not ‘pw useradd name’ but thanks for the info!

  • Robert October 2, 2007, 8:18 am

    er also you don’t have to use the -n switch for the user name

  • someone March 15, 2009, 1:22 pm

    You can either use ‘pw useradd’ or ‘pw user add’

    peace

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , ,