Linux

  1. Home
  2. Computing & Technology
  3. Linux

Linux System Administrator's Guide

From Authors, for About.com

11.2.4. Creating a user by hand

To create a new account manually, follow these steps:

  • Edit /etc/passwd with vipw and add a new line for the new account. Be careful with the syntax. Do not edit directly with an editor! vipw locks the file, so that other commands won't try to update it at the same time. You should make the password field be '* ', so that it is impossible to log in.

  • Similarly, edit /etc/group with vigr , if you need to create a new group as well.

  • Create the home directory of the user with mkdir .

  • Copy the files from /etc/skel to the new home directory.

  • Fix ownerships and permissions with chown and chmod . The -R option is most useful. The correct permissions vary a little from one site to another, but usually the following commands do the right thing:


       

    cd /home/newusername
    chown -R username.group .
    chmod -R go=u,go-w .
    chmod go= .

  • Set the password with passwd .

After you set the password in the last step, the account will work. You shouldn't set it until everything else has been done, otherwise the user may inadvertently log in while you're still copying the files.

It is sometimes necessary to create dummy accounts that are not used by people. For example, to set up an anonymous FTP server (so that anyone can download files from it, without having to get an account first), you need to create an account called ftp. In such cases, it is usually not necessary to set the password (last step above). Indeed, it is better not to, so that no-one can use the account, unless they first become root, since root can become any user.


   Prev    Home    Next
   What's an account?    Up    Changing user properties

* License

* Introduction to Linux Index

Explore Linux

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Linux

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux Documentation
  5. System Administration
  6. Linux System Administrator's Guide - 11.2.4. Creating a user by hand

©2009 About.com, a part of The New York Times Company.

All rights reserved.