Sunday, April 18, 2010

How to setup/change password in a command line

If changing your own password you just need to run in the terminal this:

passwd

and you will be prompted to enter your current password. Once you do this successfully you need to enter twice the new password.

You may also need to setup one or change the password for another user. Then of course you need to login as root and run the following:

passwd user_name

where user_name is the username of the user in question. The system prompts you to enter the password twice, and that's it.

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