09: OCI ‐ Key‐Based Access to an Instance - pavankumarchittajallu/OCI_DOC GitHub Wiki
Step-by-Step Approach for Key-Based Access to an OCI Instance
Steps to enable password-based access.
1. Open a valid Terminal like Putty and enter the public IP of the instance created under session category of the terminal.
2. Browse a location for putty log file under Logging category in the Terminal
3. Browse and select private PPK format key file under Auth category under SSH
4. Now click Open to enter to the terminal. Login as OPC, as we did the first time as a user.
5. Switch to root user
[opc@f2fdev ~]$ sudo su root [root@f2fdev opc]# pwd /home/opc [root@f2fdev opc]# whoami root
6. You are setting up password for root user.
passwd root
7. Enable password-based authentication.
a. Navigate to the /etc/ssh folder or directory in the terminal.
cd /etc/ssh
b. List all the contents in the directory.
ls -lrth
c. Recommended to back up sshd_config file using copy command
cp sshd_config sshd_config_0711_bkp
.
d. After taking a backup, open the sshd_config file and edit it using vi editor
vi sshd_config
e. Look up permit root login, then add permit root login yes below, ensuring it isn't preceded by # (i.e. it's not commented out) in Insert mode
f. Search for password authentication, then add password authentication yes below, ensuring it isn't preceded by #
g. Next, find the path where changes can be made to enable password authentication using search ()
h. Run again ls -lrth and look for sshd_config.d
i. Navigate to the above folder sshd_config.d j. check difference between both files before restarting the server 'diff sshd_config sshd_config_bkp`
8. Now check the status of the server as well
systemctl status sshd
9. Finally, restart the server.
systemctl restart sshd
10. Do not log out from the current session; keep it active and open. Open a new session. ** Session Errored OUT **