简体   繁体   中英

How to setup ssh connection between lxc container and an ubuntu machine

I am new to ansible.I have an ubuntu machine where i have installed Ansible and 3 lxc containers.I am not able to setup ssh connection between the source machine which is ubuntu VM and container.I want to use passwordless authorization between them.

I generate ssh keys through ssh Keygen and trying to add that to lxc container with the below command: ssh-copy-id -i /root/.ssh/id_rsa.pub root@10.0.3.4 It says permission denied. I am not able to login in ssh container via ip address 10.0.3.4 but i can login in there by name db1 for some reason. I changed password Authentication to yes in sshd.config file.

All the linux distribution have by default disabled the ssh via root user as a security measure - this might be one of the reason that you are facing permission denied error.

I would suggest you to create a new user for ansible and use this user to ssh to the remote server.

Note: Don't use root or enable ssh login via root user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM