Linux-RedHat Create/Add User to Server

Tags linux

 

Audience

Staff 

Overview

This guide outlines the steps to manually add a user to a Linux server on RHEL-based systems like CentOS and Fedora. It covers connecting via SSH, using sudo or root access, creating a user with the "useradd" command, setting a password, assigning group permissions, and verifying the user in /etc/passwd. These straightforward steps ensure proper user setup and access control.

 Steps to add user to a Linux server manually

 

For Red Hat Enterprise Linux (RHEL) system, or other similar distributions like CentOS and Fedora, you typically use the 'useradd' command to create a new user. The 'useradd' command is available by default on these systems. following is a step-by-step guide:

  1. First, you need to connect to your server. You can do this via SSH. You can use any application like PuTTY or MobaXterm  or Command prompt to SSH into the server.
  2. Once logged in, you might need to switch to root user or use 'sudo' to perform administrative tasks, depending on your permissions. 
  3. To add a new user, we can use the command  " sudo useradd -m newusername ". The flag -m option tells to create the user's home directory if does not exist. 
  4. After creating the user, you should set a password for the account to allow the new user to login. You can use "sudo passwd newusername" command to setup the password. ( A user can always change the password for the account) 
  5. If you want to the new user to have administrative right ( similar to using 'sudo') or any other certain permissions you can add the new user in a group or multiple groups. For that you have to user the command "sudo usermod -aG groupname newusername" 
  6. You can verify that the new user has been created successfully by checking the contenty of the "/etc/passwd"

 

 

 

 

Feedback and Concerns:

If you have any feedback regarding this article, please reach out to hsitkb@pitt.edu.  You can also leave a comment below as well.