The error is because our server are not intended to have root access from ssh.
Kamal need to have elevated priviledge to run this as root. Behind the scene, kamal will run:
# just for demonstration
$ ssh [email protected]
If you try to login as root to your server, you will get:
[email protected]: Permission denied (publickey).
So we are going to fix it in this step!
SSH into your server as normal user
We will first ssh into our Homelab Server as normal user, and then run elevated command.
# change accordingly
$ ssh [email protected]
Then, we will elevate our user, and edit the authorized_keys
# when prompted, enter your password
sudo su
# change <github_username> to yours
curl -s https://github.com/<github_username>.keys >> ~/.ssh/authorized_keys
# verify authorized_keys populated
cat ~/.ssh/authorized_keys
# exit the root session
exit
# exit your normal session
exit
Now if you exited that SSH, and try to login as root
, it will now work!
ssh [email protected]
Now that we know why kamal fails, and the concern behind it, we can proceed to our step earlier.