SSH to LXC container with Pubkey

ssh_to_container.sh
ssh [user]@[my-container-address]

Problem

example.txt
[user]@[my-container-address] Permission denied (publickey). 

Solution

Change the sshd_config

edit_sshd_config.sh
vim /etc/ssh/sshd_config 

from this

example.txt
# PubkeyAuthentication no

to this

example.txt
PubkeyAuthentication yes

. Do not forget to add your pubkey to your authorized keys.

add_authorized_keys.sh
mkdir /home/[myuser]/.ssh & vim /home/[myuser]/.ssh/authorized_keys

Check out similar posts by category: Allgemein