The useradd command will let you add a new user easily from the command line:
#useradd username
Ex : useradd user1
This command adds the user, but without any extra options your user won’t have a password or a home directory. You can use the -d option to set the home directory for the user. The -m option will force useradd to create the home directory.
We will try creating a user account with those options, and then use the passwd command to set the password for the account. You can alternatively set a password using -p on the useradd command, but I prefer to set the password using passwd.
#useradd -d /home/user1 -m user1
#passwd user1
Important locations for users
* /etc/passwd - User account information.
* /etc/shadow - Secure user account information such as password.
* /etc/group - Group account information.
* /etc/default/useradd - Default values for account creation.
* /etc/skel/ - Directory containing default files.
* /etc/login.defs - Shadow password suite configuration.
#useradd username
Ex : useradd user1
This command adds the user, but without any extra options your user won’t have a password or a home directory. You can use the -d option to set the home directory for the user. The -m option will force useradd to create the home directory.
We will try creating a user account with those options, and then use the passwd command to set the password for the account. You can alternatively set a password using -p on the useradd command, but I prefer to set the password using passwd.
#useradd -d /home/user1 -m user1
#passwd user1
Important locations for users
* /etc/passwd - User account information.
* /etc/shadow - Secure user account information such as password.
* /etc/group - Group account information.
* /etc/default/useradd - Default values for account creation.
* /etc/skel/ - Directory containing default files.
* /etc/login.defs - Shadow password suite configuration.
No comments:
Post a Comment