4. Enabling Password based access for Root user - Ayushi-srivastav/OCI GitHub Wiki

Steps to enable password access

Step 1 : Open putty

  1. Open Putty App

Paste Public IP under session category

image

  1. Select location for putty log file under Logging category

image

  1. Browse and select private PPK format key file under Auth category under SSH

image

And click on Open

Now Putty is open.

Step 2 : Switch from opc user to root user

as we are login first time, we will login from opc user

image

  1. Switch to root user
Sudo su -root

image

  1. Now set password for root user
passwd root

and then write password.

image

Step 3 : Enable password based login

  1. Go to the ssh service under etc directory
cd /etc/ssh

and list all files & directories in ssh

ls -lrth
  1. Now take backup of sshd_config file using copy command
cp sshd_config sshd_config_bkp

*sshd_config_bkp (backup file name)

and again list all files & directories to check backup file is created or not.

ls -lrth

image

  1. After taking backup, we open the sshd_config file and edit it
vi sshd_config

image

  1. Look up permit root login, then add permit root login yes below, ensuring it isn't preceded by #, using the Insert button.

image

  1. Search for password authentication then add password authentication yes below, ensuring it isn't preceded by #, using the Insert button.

image

(6) Next,Find the path where changes can be made to enable password authentication.

Press shift / include

and we will get the path for file (In which we have to do modification)

Include /etc/ssh/sshd_config.d/*.conf

image

(7) Next, exit from file sshd_config and run again ls -lrth and look for sshd_config.d

image

Enter in sshd_config.d folder and run ls -lrth

and look for 50-cloud-init.conf file

image

Now, Run vi 50-cloud-init.conf

image

Search for password authentication and change it to yes, using Insert Button.

image image

To save the file

:wq!

(shift+: wq!)

enter

image

  1. check difference between both files before restarting the server
diff sshd_config sshd_config_bkp

image

  1. Now check the status of the server as well
systemctl status sshd

image

  1. lastly Restart the server
systemctl restart sshd

image

  1. Before logging out of the current session, keep it open and log in from a new session.

image

If the new session opens successfully, you can log out. If not, try to fix the error in the sshd file while in the current session.