Docker centos7 安装ssh

 

参考:

http://www.thinksaas.cn/topics/0/516/516528.html

 

docker run -i -t centos:7 /bin/bash

 

yum install passwd openssl openssh-server -y

 

ssh-keygen -q -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -N '' 

ssh-keygen -q -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ''

ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key  -N '' 

 

sed -i "s/#UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config

sed -i "s/UsePAM.*/UsePAM no/g" /etc/ssh/sshd_config

 

/usr/sbin/sshd -D