Skip to content

SSH into the host without Keyfile

Suraj Gupta Gudla edited this page Apr 7, 2022 · 1 revision

You need to follow the below steps to enable SSHing into the instance without a key file.

Steps:

1. Install and enable SSH on the host instance

Reference: (https://www.cyberciti.biz/faq/ubuntu-linux-install-openssh-server/)

2. Add a new user <login_name> and assign a password to it. Also, add this user to the sudo group using the below commands

$ sudo adduser  <login_name>
$ sudo passwd <login_name>
$ sudo usermod -aG sudo <login_name>

3. Edit the SSH configuration settings file using

$ sudo visudo /etc/ssh/sshd_config

Set the parameters as below,

  • PasswordAuthentication yes - For allowing a valid user to log in without the key
  • PermitRootLogin yes - If you want to allow root login without a key as well

4. Restart the SSH service using

$ sudo systemctl restart sshd.service 

5. Try SSHing into the instance by just using the login_name and IP address

$ ssh <login_name>@<public ip_address>

6. If it does not work, try editing the ssh-config file too using

$ sudo visudo /etc/ssh/ssh_config
$ sudo systemctl restart ssh.service