关于ubuntu:ubuntu-ssh登录docker

6次阅读

共计 651 个字符,预计需要花费 2 分钟才能阅读完成。

进入容器后

# 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
正文完
 0