最近要调试新的程序,买了一台服务器安装了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_*
# 使用sftp
Subsystem sftp /usr/lib/openssh/sftp-server
查看配置文件,一般都默认开启部分参数。只需要参照上面的参数进行修改就可以了,把#注释去掉就可以开启该功能。yes表示开启该功能,no表示不开启功能,#注释表示禁用该配置。
修改完成保存后,进行重启ssh服务
/etc/init.d/ssh restart
页面更新:2024-02-29
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号