linux setup

Create a New Sudo User

To add a new sudo user, open the terminal window and enter the command:

adduser UserName

Use the actual username for your new user in place of UserName.

Next, create a password for the new user by entering the following in your terminal window:

passwd UserName

The system should display a prompt in which you can set and confirm a password for your new user account. If successful, the system should respond with “all authentication tokens updated successfully.”

Add User to Group

To add a user to the wheel group, use the command:

sudo usermod –aG wheel UserName

As usual, replace UserName with the name of the user receiving sudo privileges.

Step: 3 Switch to the Sudo User

Switch to the new (or newly-elevated) user account with the su (substitute user) command:

su - UserName

Enter the password if prompted. The terminal prompt should change to include the UserName.

ssh -i your-key.pem username@ip_address

Step 2: Setup a password for the user using passwd command along with the username.

sudo passwd ubuntu

Step 3: Edit sshd_config file.

sudo vim /etc/ssh/sshd_config

Find the Line containing 'PasswordAuthentication' parameter and change its value from 'no' to 'yes'

PasswordAuthentication yes

If you want to set up 'root' login, find 'PermitRootLogin' parameter and change its value from 'prohibit-password' to 'yes'

PermitRootLogin yes

After this changes save file and exit. Step 4: Restart the SSH service.

service ssh restart ## for ubuntu service sshd restart ## for centos

Step 5: Now we can log in using the password you set for the user. For example,

ssh ubuntu@54.224.72.66

Last updated