关于ubuntu:ubuntu-ssh登录docker

进入容器后

# install ssh
$ apt-get install openssh-client
$ apt-get install openssh-server

# start ssh service
$ /etc/init.d/ssh start
 * Starting OpenBSD Secure Shell server sshd        [ OK ] 

# enable root login
$ vim /etc/ssh/sshd_config

#------------ in file sshd_config -------------#
# "PermitRootLogin yes" needs adding
...
#LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
...
#---------- end of file sshd_config -----------#

# restart service
$ service ssh restart
* Restarting OpenBSD Secure Shell server sshd            [ OK ] 


# set password of user root
$ passwd root

# add port to ssh
$ /usr/sbin/sshd -p 12345

# checkout ip
$ apt-get install net-tools
$ ifconfig

在其余中央连贯

$ ssh root@{ip got above} -p 12345

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理