Posted On June 18, 2019

Linux User and Group General Operations

kimconnect 0 comments
blog.KimConnect.com >> Linux >> Linux User and Group General Operations
# Add new user
useradd tomcruise

# Create new group
groupadd webadmins

# Add user to group
usermod -a -G webadmins tomcruise

# Assign a specific UID to user
usermod -u 2000 tomcruise

# Please note that all files which are located in the user's home directory will have the file UID changed automatically as soon as you type above command. Symlinks outside of the home directory will require manual chown to prevent access issues after the change. Here's the fix:
find / -user 2000 -exec chown -h tomcruise {} \

# Verify stuff
grep tomcruise /etc/passwd # Check Tom's UID
ls -l /home/tomcruise/ # Check Tom Cruise's home
id -u tomcruise # Check Tom's UID

# Assign a specific GID to group
groupmod -g 3000 webadmins

# Similar to changing UID, GID modifications will need to be followed up with this command:
find / -group 3000 -exec chgrp -h webadmins {} \

# Note that the necessary -h option on the chgrp/chmod commands affect symbolic links instead of their referenced files/directories.

# Verify groupies
id -g webadmins # Check webadmins' GID
grep tomcruise /etc/group # Check Tom's group assignment

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Linux: how to make automounts persistent

# Step 1: discover the device using its current mount path mountPath=/media/kim/Data findmnt | grep…

Installing Kubernetes on CentOS 8.1

Step 1: Preparing All Nodes # Installing prerequisites # Update before installation sudo su yum…

How to Add Printers on Linux Mint 20

Overview: The Common Unix Printing System (CUPS) is an open source printing system developed by…