Content

Wednesday, October 28, 2015

How to create a user, group and enable him to do what a super user can in CentOS7?

As with all OS, we first need to make sure that we can create users. The users are of two types.

  1. Super Users (Administrators in Windows World)
  2. All configurations should be done using this account.
  3. Normal Users
  4. All services, development, browsing should be done using this account.

It's a best practice to not do any development with the root user and have separate account that can be a Super User and another account that can do the normal services or development work.

When a task needs to be done that requires the super user privileges we switch between a super user and the normal user and then switch back to the normal user. Always work with the normal user. Note this concept is new for Windows Users. This is similar to the run as but within the same window you can keep switching users to perform tasks with the corresponding privileges.

When you installed CentOS 7 it would expect you to have the root user and its password. You need to know this before you can create these types of users.

Creating a Super User using SSH Terminal
  1. Using putty SSH into the CentOS 7 Server using root credentials
  2. Since you are the root you can give the following command to create the admin user and add him to the root group
  3. 
    useradd -g root bigdataadmin
    
    
  4. Now we need to change the password
  5. 
    passwd bigdataadmin
    
    
    Give a strong password.
  6. In order for this user to switch to a super user to perform task the require super user privileges we need to give permission. This is done by using
  7. 
    gpasswd -a bigdataadmin wheel
    
    
Creating a Normal User using SSH Terminal
  1. Using putty SSH into the CentOS 7 Server using the previously created "bigdataadmin" user
  2. Since this time you are not the root you need to use the following to create the user and the group. Note the use of sudo in front of the command. This stands for "super user do"
  3. First create the group
  4. 
    sudo groupadd bigdatagroup
    
    
    It would prompt for a password, enter the password created in the previous step.
  5. Create the user
  6. 
    sudo useradd -g bigdatagroup bigdatauser
    
    
  7. Change the password
  8. 
    sudo passwd bigdatauser
    
    

Note: As with all articles, Open source technologies are sometimes not backward compatible, please check the version number before following this lesson or any lesson on this site.




No comments:

Post a Comment