Saturday, April 17, 2010

How to create new user account in Debian/Ubuntu linux from a command line

The following works in Debian and Ubuntu linux.

The best and least problematic way to create new user account on a Linux system is from a command line:

useradd -m -g group -s /bin/bash new_user_name

After running this code as a root, you will end up with a new account new_user_name, with the correspondingly named home directory, default login shell bash, and belonging to the group group. If -g is not specified, a primary user group will be created with the same name as the user being added to the system.

Some important files related to accounts (for Debian based distros):
  • /etc/passwd - user accounts info
  • /etc/shadow - passowrds (encrypted) and other secure user accounts info
  • /etc/group - group account info
  • /etc/default/useradd - default values for account creation

No comments:

Post a Comment