User Management in Linux (Red Hat/CentOS)
User Management in Linux
How to know the user details
chirag@chirag-MacBookAir:~$ getent passwd username
How to know the id of user
chirag@chirag-MacBookAir:~$ id username
How to change the UID
chirag@chirag-MacBookAir:~$ usermod -u 2000 username
How to create the user with the specific UID
chirag@chirag-MacBookAir:~$ useradd -u 3000 username
How to change the password
chirag@chirag-MacBookAir:~$ passwd username
How to add secondary group
chirag@chirag-MacBookAir:~$ usermod -a -G dhawal chirag (dhawal is added to the chirag)
How to get help
chirag@chirag-MacBookAir:~$ useradd -- <tab><tab>
How to set shell
chirag@chirag-MacBookAir:~$ usermod -s /bin/bash
How to create user with existing directory
chirag@chirag-MacBookAir:~$ useradd chirag -d /home/qwer chirag@chirag-MacBookAir:~$ usermod -m -d /var/www/html nobody
How to allow nobody user in apache group (nobody wants to access same permission of apache)
chirag@chirag-MacBookAir:~$ vim /etc/group apache:::nobody