Explained User management in linux with practical examples
In this
article we learn user management in linux that include how to create new user, how
to set password for the new user, how to create custom home directory, how to
create user without home directory, how to describe about the user, how to
create custom shell for the new user, how to create custom primary group for
the new user and how to set secondary group for the created new user.
Maintain
user management is the most important task for an system administrator.
How to create new user in linux system
To create a
new user account we need to execute ”useradd” command to the shell. After
executing this command new use account will be created with its own home
directory, its own shell and automatically create its own primary group.To add
the new user we execute the below command.
#useradd
test <here test is
the username>
After
execute the above command user is created
but account will be locked. To unlock the user account we need to
execute the “passwd” command. After execute the below command the use account
will be unlock.
Explained User management in linux with practical examples |
How to create custom home directory for new user in linux system
When we are
going to create new user its home directory is automatically created. To create
the custom directory we use “-d” switch. First we need to create the the
specified location in which user home directory is created and then we use “-d” switch to create custom
directory.
Suppose our
specified location is “/testuser/test” .we first create “/testuser/test”
directory and to set it we use the below command.
#useradd
–d /testuser/test test
How to create user without home directory
To create a
user without home directory we use “-M” switch. We need to execute the below
command.
#useradd
–M test
How to describe about the new user
When we
create to a new user for an organization we need to mention the description for
the new user. To do this we use “-c” switch.
#useradd
–c “user description” test
How to create custom shell for the new user
When we
create a new user “/bin/bash” shell is automatically created. To create the
custom shell we use “-s” switch to execute it.
#useradd
–s /bin/ksh
How to create custom primary group
When a user
is create its primary group is automatically created. To change it forcefully to a custom group we use
“-g” switch.
#groupadd primary
#useradd –g primary
test
How to add a user to a secondary group
To belong the test user in the
secondary group we use “–G” switch.
#groupadd
secondary
Please Donate To Bitcoin Address: [[address]]
Donation of [[value]] BTC Received. Thank You.
[[error]]
0 comments:
Post a Comment