User Management in Centos using command line


User Management

How to know the user details

[email protected]:~$ getent passwd username

How to know the id of user

[email protected]:~$ id username

How to change the UID

[email protected]:~$ usermod -u 2000 username

How to create the user with the specific UID

[email protected]:~$ useradd -u 3000 username

How to change the password

[email protected]:~$ passwd username

How to add secondary group

[email protected]:~$ usermod -a -G dhawal chirag (dhawal is added to the chirag)

How to get help

[email protected]:~$ useradd -- <tab><tab>

How to set shell

[email protected]:~$ usermod -s /bin/bash

How to create user with existing directory

[email protected]:~$ useradd chirag -d /home/qwer
[email protected]:~$ usermod -m -d /var/www/html nobody

How to allow nobody user in apache group (nobody wants to access same permission of apache)

[email protected]:~$ vim /etc/group

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.