I noticed that the username/password I use to connect to a newly created LXC container via lxc-console doesn't work with ssh (with sshd running in the container). When I try, I get Permission denied Why is that, and how can I make it work?

share|improve this question
up vote 1 down vote accepted

inside container, open /etc/ssh/sshd_config and change PermitRootLogin to yes.

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
share|improve this answer

Do you allow passwords for SSH? Do you have an iptables rule for port forwarding from your host to the LXC container IP address? You can add one with the following line (change port to your container's ssh port):

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 1234 -j DNAT --to 10.x.x.x:1234
share|improve this answer

A newly created LXC container using the ubuntu-cloud template comes with the SSH daemon configured to not allow passwords:

To fix this, attach to your container and edit the /etc/ssh/sshd_config file. Look for the following:

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no

And change PasswordAuthentication to "yes" and restart SSH:

service ssh restart

Then you should be able to log in to your container with a password.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.