I have 2 machines:
WSL
installed, that serves as a client.test-user
user, that serves as a server.Both computer are on the same network.
On the Ubuntu computer, what I did:
ssh-keygen
to generate two keys, I copied the id_rsa file to the WSL
.systemctl status ssh
.On the WSL, what I did:
chmod 600 key
.ssh -i key [email protected]
This works well, but it also ask me the password of the user.
hamuto@DESKTOP-HLSFHPR:~$ ssh -i key [email protected]
[email protected]'s password:
The problem with this thing is, that with Github Actions
, I can't enter the password.
So I changed the file /etc/ssh/sshd_config
in the server:
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no <-- I've changed that to no, and uncomment the line
#PermitEmptyPasswords no
When I retry to connect with ssh:
hamuto@DESKTOP-HLSFHPR:~$ ssh -i key [email protected]
[email protected]: Permission denied (publickey).
After days of research, I found the solution:
id_rsa.pub
in the ~/.ssh/authorized_keys
.chown -R username:username /home/username/.ssh
chmod 700 /home/username/.ssh
chmod 600 /home/username/.ssh/authorized_keys
PubkeyAuthentication
in the file /etc/ssh/sshd_config
to yes and uncomment it.id_rsa
key, to the client. Set the permission to 600
.You can connect to the server:
ssh -i ~/.ssh/id_rsa [email protected]
Now it works.