Skip to content

In this Repository you will learn how to create user and set the password and Change the Password of Existing user in the linux OS

Notifications You must be signed in to change notification settings

SelviShankari/linux-user-password-setup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Create Linux User and Enable SSH Password Authentication (Ubuntu)

This document describes the complete procedure to create a Linux user, grant sudo access, enable SSH password authentication, and verify access on an Ubuntu server (AWS EC2 compatible).


Step 1: SSH Into the Server

Login to the server where the user needs to be created.

ssh ubuntu@<server-ip>

Step 2: Create a New User

Create the user if it does not already exist.

sudo adduser shivam

Follow the prompts to set the password and user details.


Step 3: Grant Sudo Access (Optional)

Add the user to the sudo group to allow administrative privileges.

sudo usermod -aG sudo shivam

Verify the group assignment:

groups shivam

Step 4: Enable Password Authentication (Primary SSH Config)

Edit the main SSH configuration file.

sudo vi /etc/ssh/sshd_config

Ensure the following lines exist and are set exactly as shown:

PasswordAuthentication yes
UsePAM yes
KbdInteractiveAuthentication no

If the lines are commented (#), uncomment them.

Save and exit the file.


Step 5: Update Cloud-Init SSH Override (Required on AWS)

Cloud-init can override SSH settings on AWS EC2 instances.

Edit the cloud-init SSH configuration file:

sudo vi /etc/ssh/sshd_config.d/50-cloud-init.conf

Ensure the following line exists:

PasswordAuthentication yes

Save and exit the file.


Step 6: Restart SSH Service

Restart the SSH service to apply changes.

sudo systemctl restart ssh

Verify SSH service status:

sudo systemctl status ssh

Ensure the service is running without errors.


Step 7: Fix User Home Directory Permissions

Set correct ownership and permissions for the user home directory.

sudo chown -R shivam:shivam /home/shivam
sudo chmod 700 /home/shivam

Step 8: SSH Login Using the New User (Private IP)

Login using the newly created user via private IP (VPN required).

ssh shivam@10.0.2.192

Enter the password when prompted.


Step 9: Add Existing User to Sudo Group (Reference)

If the user already exists and requires sudo access:

sudo usermod -aG sudo shivam

Logout and login again for group changes to take effect.


About

In this Repository you will learn how to create user and set the password and Change the Password of Existing user in the linux OS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published