• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Monday, May 12, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to create and manage users, groups, and permissions in CentOS 7

in CentOS, Linux OS
How to create and manage users, groups, and permissions in CentOS 7

CentOS 7 is a popular Linux distribution used by many organizations for their servers and workstations. One of the important aspects of system administration is managing users, groups, and permissions. In this blog, we will explore how to create and manage users, groups, and permissions in CentOS 7.

Creating Users in CentOS 7

Creating a user in CentOS 7 is a simple process.

To create a user, you need to have root privileges. Once you have the root privileges, follow the steps below to create a new user:

Step 1: Open the terminal and log in as the root user.

sudo su

Step 2: Use the adduser command to create a new user. Replace ‘username’ with the desired username for the new user.

adduser username

Step 3: Set a password for the user by running the following command. Replace ‘username’ with the username of the new user.

passwd username

Managing Users in CentOS 7

You can manage users in CentOS 7 using the usermod command. Some of the common tasks that you can perform using the usermod command are:

  1. Change the user’s home directory:
usermod -d /new/home/directory username
  1. Change the user’s login name:
usermod -l newusername oldusername
  1. Add the user to a group:
usermod -aG groupname username
  1. Lock the user’s account:
usermod -L username
  1. Unlock the user’s account:
usermod -U username

Creating Groups in CentOS 7

Creating a group in CentOS 7 is similar to creating a user. Follow the steps below to create a new group:

Step 1: Open the terminal and log in as the root user.

sudo su

Step 2: Use the groupadd command to create a new group. Replace ‘groupname’ with the desired group name.

groupadd groupname

Managing Groups in CentOS 7

You can manage groups in CentOS 7 using the groupmod command. Some of the common tasks that you can perform using the groupmod command are:

  1. Change the group’s name:
groupmod -n newgroupname oldgroupname
  1. Add a user to the group:
gpasswd -a username groupname
  1. Remove a user from the group:
gpasswd -d username groupname
  1. Delete a group:
groupdel groupname

Setting Permissions in CentOS 7

Permissions are used to control access to files and directories in CentOS 7. The chmod command is used to set permissions on files and directories. The chmod command uses a three-digit code to set permissions.

The three-digit code consists of the following:

  1. The first digit specifies the file type and sets the special permissions.
  2. The second digit specifies the permissions for the owner of the file.
  3. The third digit specifies the permissions for the group owner of the file.
  4. The fourth digit specifies the permissions for everyone else.

The digits can have values from 0 to 7. The value of each digit determines the permissions that are set. The values and their corresponding permissions are:

0: No permissions 1: Execute 2: Write 3: Write and execute 4: Read 5: Read and execute 6: Read and write 7: Read, write, and execute

For example, to set the permissions of a file to read and write for the owner, read-only for the group owner, and read-only for everyone

ShareTweet
Previous Post

How to install and configure virtualization software on CentOS 7 with KVM

Next Post

How to configure and manage system services in CentOS 7 with systemd

Related Posts

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

Leave a Reply Cancel reply

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

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.