由于本机是win10,在本地安装了Docker,打算部署一个开发环境,使用cmd方式进入docker 使用感受不佳,因此使用Xshell进行连接,效果优于使用VM虚拟机,关于如何配置docker镜像,查看以前的笔记,现在对这个配置过程进行记录……
win10
Docker
image: CentOS8
首先,确保CentOS8 已经安装了openssh-server, 使用yun list installed | grep openssh-server 命令来查看是否看装。
[root@192eee0845e0 ~]# yum list installed | grep openssh-server
openssh-server.x86_64 8.0p1-4.el8_1 @BaseOS
没有安装的话,运行:yum install openssh-server
确保已经安装完毕后,使用find命令,查找/etc/ssh/目录下的sshd_config服务配置文件
[root@192eee0845e0 ~]# find / -name sshd_config
/etc/ssh/sshd_config
编辑sshd_config
[root@192eee0845e0 ~]# vi /etc/ssh/sshd_config
修改sshd_config 如下:
1. 去掉#,开启22端口,监听地址
Port 22
#AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::
2.允许远程登陆
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
3.开启使用用户名和密码作为连接验证
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes
保存退出后,即可开启ssh服务:
systemctl start sshd.service
使用Xshell 连接时候,需要提供用户名和密码
设置用户名,密码时候需要先安装passwd
[root@192eee0845e0 ~]# yum install passwd
Last metadata expiration check: 0:18:58 ago on Tue 03 Mar 2020 08:32:11 AM UTC.
Dependencies resolved.
========================================================================================================================
Package Architecture Version Repository Size
========================================================================================================================
Installing:
passwd x86_64 0.80-2.el8 BaseOS 114 k
Installing dependencies:
libuser x86_64 0.