当前位置:首页 > 编程笔记 > 正文
已解决

Docker使用ssh连接ubuntu容器

来自网友在路上 141841提问 提问时间:2023-09-21 15:08:34阅读次数: 41

最佳答案 问答题库418位专家为你答疑解惑

容器ssh配置

  1. 启动容器
docker run -it -p 2222:22 ubuntu
  1. 更新
apt update 
  1. 配置密码
passwd
  1. 安装openssh-server
apt install openssh-server
  1. 配置ssh
echo "UsePAM no" >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
  1. 启动ssh
service ssh start

ssh连接容器

ssh root@localhost:2222
查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"Docker使用ssh连接ubuntu容器":http://eshow365.cn/6-10764-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!