Display list of shell
Code:
less /etc/shells
cat /etc/shells
more /etc/shells
Change the user login shell to /bin/ksh for foo user
Code:
chsh -s /bin/ksh foo
chsh -s /bin/bash username
-----------------
Adding user
-----------------
Syntax: # useradd -s <SHELL> -m -d <HomeDir> -g <Group> UserName
-s SHELL : Login shell for the user.
-m : Create user’s home directory if it does not exist.
-d HomeDir : Home directory of the user.
-g Group : Group name or number of the user.
UserName : Login id of the user.
Create Linux User with Custom Configurations Using useradd Command
-----------------------------------------------------------------------------
The following example creates an account (lebron) with home directory /home/king, default shell as /bin/csh and with comment “LeBron James”.
# useradd -s /bin/csh -m -d /home/king -c "LeBron James" -g root lebron
# grep lebron /etc/passwd
lebron:x:513:0:LeBron James:/home/king:/bin/csh
-------------------------
Verify user information:
-------------------------
# finger david
Output:
Login: david Name: david gilmour
Directory: /iscsi/user/vivek Shell: /bin/bash
Last login Thu Sep 13 07:58 2007 (IST) on pts/1 from 10.16.15.2
No mail.
No Plan.
------------------------------------------------------------------------------------------------------
You can use the usermod command. The following (run as root) will change the user smith's
home directory to /tmp/smith and move all of their files with it.
Code:
usermod -m -d /tmp/smith smith
Code:
less /etc/shells
cat /etc/shells
more /etc/shells
Change the user login shell to /bin/ksh for foo user
Code:
chsh -s /bin/ksh foo
chsh -s /bin/bash username
-----------------
Adding user
-----------------
Syntax: # useradd -s <SHELL> -m -d <HomeDir> -g <Group> UserName
-s SHELL : Login shell for the user.
-m : Create user’s home directory if it does not exist.
-d HomeDir : Home directory of the user.
-g Group : Group name or number of the user.
UserName : Login id of the user.
Create Linux User with Custom Configurations Using useradd Command
-----------------------------------------------------------------------------
The following example creates an account (lebron) with home directory /home/king, default shell as /bin/csh and with comment “LeBron James”.
# useradd -s /bin/csh -m -d /home/king -c "LeBron James" -g root lebron
# grep lebron /etc/passwd
lebron:x:513:0:LeBron James:/home/king:/bin/csh
-------------------------
Verify user information:
-------------------------
# finger david
Output:
Login: david Name: david gilmour
Directory: /iscsi/user/vivek Shell: /bin/bash
Last login Thu Sep 13 07:58 2007 (IST) on pts/1 from 10.16.15.2
No mail.
No Plan.
------------------------------------------------------------------------------------------------------
You can use the usermod command. The following (run as root) will change the user smith's
home directory to /tmp/smith and move all of their files with it.
Code:
usermod -m -d /tmp/smith smith
Add an Existing User to a Group
Next we’ll add a user to the group, using this syntax:
eg. usermod -a -G dockergroup stackuserusermod -a -G <groupname> username
No comments:
Post a Comment