docker 容器开启ssh服务

ssh服务安装
安装ssh服务
#yum install openssh-server -y
安装passwd(修改密码需要)
#yum install passwd -y
修改sshd_config配置文件
UsePAM yes改成UsePAM no
关闭主机selinux
当使用passwd修改容器中root密码的时候,会报错:
passwd: system_u:system_r:initrc_t:s0 is not authorized to change the password of root
这时候,需要关闭主机selinux。

原文地址:https://www.cnblogs.com/hzcya1995/p/13350922.html