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 Mint 20: How to Disable the Annoying Keyring Prompts for Passwords

Update 03/2023: https://blog.kimconnect.com/linux-how-to-bypass-annoying-login-keyring-prompts/ The default installation of Linux Mint expects that the user would login…

VMware Virtual Disk Manager Does Not Expand Partitions

If you are using the VMware Virtual Disk Manager included in GSX Server, VMware Server,…

SENDMAIL Configurations

SMTP relay will also check the source of sender by using ping-back. Thus, the servername…
Other project: DragonCoin.com