Howto: Create a New User Account in Linux (w/ Usage)

Want create site? Find Free WordPress Themes and plugins.

Creating or adding a user in Linux can be done using the useradd command. The user created via useradd command stays locked until it is assigned a password.

To add a user in any Linux distro, run the following command (adding user called ‘account-name’):

useradd account-name

EXAMPLE: Adding user called ‘Sayyam’:

useradd sayyam

Setting password for user ‘Sayyam’.

passwd sayyam

The user unlocks after setting the password.

Password & Account Expiry

Linux also has one great feature, that is, it can automatically disable an account and expire account password based on date.

The format for adding an expiry date for a user is:

useradd -e {yyyy-mm-dd} {account-name}

EXAMPLE:

useradd -e 2013-11-19 sweeno

Format for setting password expiry date:

useradd -e {yyyy-mm-dd} -f {days} {account-name}

-e option: Used to specify password expiry date.

-f option: Used to set number of days after the password expires until the user account is disabled. If -f is set to 30, account is disabled 30 days after password expiry. If -f is set to 0, account is disabled immediately after password expiry. If -f is set to -1, account is not disabled after password expiry.

EXAMPLE:

useradd -e 2013-07-05 -f 20 easter

The account is disabled 20 days after July 5.

 

Did you find apk for android? You can find new Free Android Games and apps.