How to add New user in CentOS Server

To add a new user in CentOs Linux we can use both useradd and adduser 

useradd command examples

to add a new user using useradd command  in the terminal type useradd followed by name of the username of the new user and enter

useradd centuser

Add new user using useradd command

To give new user a password use passwd command floowed by user name which will promt you to type new password to the user 

passwd centuser

assign password to the user
 
note that only root user are able change the password of the other users , none privileges user can only changed their own password

Define Custom Home Folder to New User


By Default When you add a new user , users home Folder created inside /home Directory, But you can Change Using -d option, For example lets create a user called centuser with /opt/centuser as home Directory 

useradd -d   /opt/centuser centuser 

Add new user Without Home Folder 


TO create new user a without a home Folder use -M option(Capital M)
useradd -M centuser

user without a home Folder CentOS Server

 

No comments:

Post a Comment