13: OCI‐ Enabling Password‐Based Access to an OCI Instance - pavankumarchittajallu/OCI_DOC GitHub Wiki

Step-by-Step Process for Enabling Password-Based Access to an OCI Instance

1. Connect via SSH with a Private Key (Initial Access)

  • Initially, OCI Linux instances are set up for SSH key-based authentication, not password-based logins. Use your SSH private key to connect to the instance for the first time. Step 1 : Open putty Open Putty App Paste the public IP under the session category.

2. Enable Password Authentication in SSH Configuration

  • Edit the SSH configuration file:
    sudo vi /etc/ssh/sshd_config
    
  • Find the line:
    PasswordAuthentication no
    
    and change it to:
    PasswordAuthentication yes
    
  • Also, ensure the following line is set:
    ChallengeResponseAuthentication no
    
  • Save and exit the editor.

3. Restart the SSH Service

  • Apply the changes by restarting the SSH daemon:
    sudo systemctl restart sshd
    
    or
    sudo service sshd restart
    
    depending on your Linux distribution.

4. Set or Reset the User Password

  • Set a password for the user (e.g., opc):
    sudo passwd opc
    
  • Enter and confirm the new password when prompted.

5. (Optional) Create a New User with a Password

  • If you prefer, create a new user:
    sudo useradd myuser
    sudo passwd myuser
    
    Set a password as prompted.

6. Test Password-Based SSH Login

  • From your local machine, connect using:
    ssh opc@
    
  • Enter the password when prompted. You should now be able to log in using a password instead of a private key.