最近要调试新的程序,买了一台服务器安装了pve,虚拟化了几台Debian系统。发现远程连接不了,检测发现ssh服务进程不存在,这就好办了,安装ssh服务再修改配置进行端口转发访问。
# 更新系统软件源apt-get update# 安装ssh服务apt-get install -y ssh# 安装vim编辑器apt-get install -y vim
ssh安装完成后,检查运行状态,一般安装完成后都会自动启动。
# 开启ssh服务/etc/init.d/ssh start# 关闭ssh服务/etc/init.d/ssh stop# 重启ssh服务/etc/init.d/ssh restart# 查看ssh运行状态/etc/init.d/ssh status
备份ssh配置文件
cp /etc/ssh/sshd_config{,.bak}
利用vim编辑器进行对/etc/ssh/sshd_congif
配置进行修改
Include /etc/ssh/sshd_config.d/*.conf# 访问远程端口Port 22# 允许root登录PermitRootLogin yes# 使用密码认证PasswordAuthentication yes# 是否允许空密码登录PermitEmptyPasswords no# 密码认证ChallengeResponseAuthentication no# 身份认证模块UsePAM yes# x11连接重定向X11Forwarding yes# 显示上次登录的信息PrintMotd no# 允许客户端使用变量名AcceptEnv LANG LC_*# 使用sftpSubsystem sftp /usr/lib/openssh/sftp-server
查看配置文件,一般都默认开启部分参数。只需要参照上面的参数进行修改就可以了,把#
注释去掉就可以开启该功能。yes
表示开启该功能,no
表示不开启功能,#
注释表示禁用该配置。
修改完成保存后,进行重启ssh服务
/etc/init.d/ssh restart
Copyright © 2013-2021 8a.hk All Rights Reserved. 八艾云 版权所有 中山市八艾云计算有限公司 粤ICP备14095776号