Use public key authentication for ssh instead of password
Usually, setting up key based authentication for a SSH server is as simple as a single call to ssh-copy-id. However, on UGOS, there are some extra steps required to fix the permission issues.
Instructions
To fix the SSH permissions, we need to define a new system service. First, you need to log in via SSH:
ssh USERNAME@IP
When asked for a password, use your account password.
Next, create a new file for the script
sudo nano /usr/local/bin/check_and_fix_ssh_permissions.sh
and paste the content of check_and_fix_ssh_permissions.sh inside. Make sure to replace <USER NAME>
with you actual username.
Next, create the service file
sudo nano /etc/systemd/system/ssh-permission-monitor.service
and paste the content of ssh-permission-monitor.service inside. Again, replace <USER NAME>
with you actual username.
Now reload the systemctl daemon:
sudo systemctl daemon-reload
And enable and start the service:
sudo systemctl enable ssh-permission-monitor.service
sudo systemctl start ssh-permission-monitor.service
You can also look at the service status and troublshoot issues:
sudo systemctl status ssh-permission-monitor.service
After those steps, your key should be accepted even after system reboots or configuration changes through the UGOS web interface.
Credit
This guide was originally created by RealMrCr4cker (Github repo) and is under an MIT Licence