Change from password based authentication to Key-based
Pre-Requisites
- Create an SSH key on your local system Instructions
- Login to your instance using the IONOS console function by right clicking on your instance and choosing “Console” use username root and previously set password
Create a non root user account
Copy to Clipboard
Set new user password
Copy to Clipboard
Give new user root rights by adding to sudoers
Copy to Clipboard
Upload your SSH key to the server instance from your local machine
Copy to Clipboard
Mac/linux copy the command above changing yournewusername and remote_host to the new username you create and the host IP address like yournewusername@192.168.1.1
Finally on the server change the SSHD configuration to only accept SSH keys
- On the server instance type nano /etc/ssh/sshd_config
- Go to bottom of file by pressing the down arrow amd change PasswordAuthentication yes to PasswordAuthentication no
- Enter ctrl x and then enter y to save the configuration
- Reboot instance or type systemctl restart sshd
Change from Key based authentication to password based
Pre-Requisites
- Login to server instance using key based access
Create a non root user account
Copy to Clipboard
Set new user password
Copy to Clipboard
Give new user root rights by adding to sudoers
Copy to Clipboard
Finally on the server change the SSHD configuration to accept username and password
- On the server instance type nano /etc/ssh/sshd_config
- Go to bottom of file by pressing the down arrow amd change PasswordAuthentication no to PasswordAuthentication yes
- Enter ctrl x and then enter y to save the configuration
- Reboot instance or type systemctl restart sshd
- You can now login with the previously created username and password