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

Error: 502 Gateway Error

Explanation: 502 Gateway Error generally means connection problems with an upstream proxy. In this instance,…

How To Install Adobe Acrobat Reader DC on Linux Mint 20

Adobe Acrobat Reader may be available as a .deb install-able package. However, its 'Reader DC'…

Yet Another Quick List of Linux Commands

Here's a quick list of useful Linux lines that Admins should be committing to muscle…
Other project: DragonCoin.com