linux web hosting

The most common aspect of managing users on a FreeBSD system is adding new users to your system. The VPS v2 Virtual Server has three programs for adding users to the account vadduser, adduser and pw.

vadduser
vadduser works as a "wizard" (simple, step-by-step questions you answer). vadduser creates passwd/group entries, creates the user home directory, and all necessary files. When using vadduser, press Enter to accept the defaults. The [default entries] will be surrounded by square brackets, for example [bob].

To use vadduser, type the following from the UNIX shell:

# vadduser

You will need to provide the following information to create a user:

The following is an example vadduser program:

# vadduser
Please supply answers to the series of questions below.  When a `default answer' is available, it will follow the question in square brackets.  For example, the question:
        What is your favorite color? [blue]:
has the default answer 'blue'.  Accept the default (without any extra typing!) by pressing the <Enter> key -- or type your answer and then press <Enter>.
Use the <Backspace> key to erase and aid correction of any mistyped answers -- before you press <Enter>.  Generally, once you press
<Enter> you move onto the next question.
Once you've proceeded through all the questions, you will be given the option of modifying your choices before any files are updated.
Hit ^C (Ctrl-C) at any time to quit without making changes.
Press <Enter> to continue:
(1) User Name
E-mail/FTP usernames consist of up to 16 alphanumeric characters, underscores and hyphens, but may not begin with a hyphen. Uppercase letters are discouraged in usernames.
E-mail/FTP Username: bob
(2) Password
Now, enter a password for this E-mail/FTP account. For security reasons you may want to use a password that is longer than 6 characters and that has at least one non alphabetic character.  The password will *not* be echoed to the screen and you will be required to type it twice.
E-mail/FTP Password:
Retype new password:
(3) User's Full Name
Now, enter the full name for this E-mail/FTP account.
Full Name: Bob
(4) Account Home Directory
Where would you like to put the home directory for this account?
  Enter "1" for an e-mail account home directory:     /home/bob
  Or enter in any custom path.
Select a number above or enter a path [1]:
(5) Services
Please select the services that this account will be using:
      e-mail    E-mail services
      ftp      FTP services
      shell    shell login
      web      WWW services
Enter the service name (e.g., "ftp", "mail", etc.) to toggle that service for the account. Hit <return> when you are done selecting/deselecting services for this user.
Select/deselect services [e-mail ftp shell web]:
Select a shell from the following list:
    bash
    csh
    ksh
    ksh93
    sh
    tcsh
    zsh
Enter a shell: [tcsh]:
You will need to run 'vaddhost' to add websites for this user.
'vaddhost' will create the proper directory hierarchy and add the correct <VirtualHost ...> entry in your Apache configuration file.
(6) Quotas
Enter filesystem quotas for this user. The quota should be an integer
(no decimal fractions) in megabytes (e.g., 5 = 5 megabytes). Enter 0 for no quota.
Quota (in megabytes): 25
Account setup complete.

adduser
adduser is the default FreeBSD way of adding users. adduser creates passwd/group entries, the home directory, and dot files and even sends the new user a welcome message.

adduser works as a "wizard" (simple, step-by-step questions you answer) but requires you to provide more information than vadduser. You can provide options to adduser to simplify the wizard interface even further.

Provide the following information to create a user:

  • Username
  • Full name
  • Shell
  • User’s home directory
  • Login class
  • Login group (If left blank it will be the username.)
  • Other groups
  • Password (twice)

To use adduser, type the following:

# adduser -s -q

Note: Use option -verbose if you want to see more warnings and questions or try to repair bugs.

The following is an example adduser program:

Enter username [^[a-z0-9_][a-z0-9_-]*$]:
Enter full name []:  Schmoe, Jr.
Enter shell bash csh date ksh ksh93 no sh tcsh zsh [sh]: bash
Enter home directory (full path) [/home/]:
Uid [1000]:
Enter login class: default []:
Login group  []:
Login group is ``''. Invite  into other groups: guest no
[no]:
Enter password []:
Enter password again []:
Name: joe
Password: ****
Fullname:  Schmoe, Jr.
Uid:      1000
Gid:      1000 ()
Class:   
Groups:   
HOME:     /home/
Shell:    /usr/local/bin/bash
OK? (y/n) [y]:
Added user ``''
Add another user? (y/n) [y]: n

adduser has other configuration defaults you can specify in the /etc/adduser.conf file (adduser will even write this configuration file for you if you do not use the –q option).

See the adduser man page for more details.

pw
You can use the pw program to add users, unlike vadduser and adduser, there is no wizard. You can make changes using pw very quickly after you have become familiar with it.

You will need to provide the following information to pw:

  • Username
  • UID
  • Name
  • Method
  • Group
  • Shell

The following is an example of the pw command:

# pw user add -n joe -c "Joseph Schmoe, Jr." -m -h 0

At the end of the pw process, you will be prompted for the user password. Use caution at this point since you will only be asked for the user password once.

These command-line options are likely the only ones you will use (unless you have more complex needs, of course, in which case the pw man page will be more useful to you).

Note: Ignore the –Y and –y options unless you're running YP/NIS (a system comprised of network equivalents of passwd, group, hosts, and other common services). Further, until you begin customizing policy information and default startup files for new users (advanced techniques not covered in this tutorial), you can ignore the -C, -D, -k, and -L options. Unless you plan on setting account expiration policies (i.e., an account will expire, or a user's password will expire, forcing them to reset it), you can ignore the -e, and -p options.

Note: You can type user add as two words, or useradd as one word. The first syntax is preferred because it reminds that user is interchangeable with group, and add is interchangeable with del, mod.

Hosting  ::  Web Design  :: Server Administration  ::  Tech Support  ::  Contacts
Data Centers  ::  Tier I Global IP Network  ::  SLA/Contracts  ::  Search  ::  Account Login