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).
Login to the server where the user needs to be created.
ssh ubuntu@<server-ip>Create the user if it does not already exist.
sudo adduser shivamFollow the prompts to set the password and user details.
Add the user to the sudo group to allow administrative privileges.
sudo usermod -aG sudo shivamVerify the group assignment:
groups shivamEdit the main SSH configuration file.
sudo vi /etc/ssh/sshd_configEnsure 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.
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.confEnsure the following line exists:
PasswordAuthentication yes
Save and exit the file.
Restart the SSH service to apply changes.
sudo systemctl restart sshVerify SSH service status:
sudo systemctl status sshEnsure the service is running without errors.
Set correct ownership and permissions for the user home directory.
sudo chown -R shivam:shivam /home/shivam
sudo chmod 700 /home/shivamLogin using the newly created user via private IP (VPN required).
ssh shivam@10.0.2.192Enter the password when prompted.
If the user already exists and requires sudo access:
sudo usermod -aG sudo shivamLogout and login again for group changes to take effect.