ssh

服务器 寻梦 3年前 (2021-08-20) 617次浏览 0个评论 扫描二维码
文章目录[隐藏]

安装

ubuntu

apt-get update
apt-get install openssh-server 

配置

# 编辑配置文件 编辑后每次都要重启
vim /etc/ssh/sshd_config
# 默认禁止root密码登录
PermitRootLogin prohibit-password
修改为: PermitRootLogin yes
#允许密码登录
PasswordAuthentication yes
 # Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp #修改 开启ssh的内置sftp 
# 重启服务
 service ssh restart
或者 /etc/init.d/ssh restart
# 设置ssh密码
passwd root
# 修改ssh默认端口
vim /etc/ssh/sshd_config 重启sshd    # /etc/init.d/sshd restart  或  # service sshd restart 

众所周知,sshd_config是sshd的配置文件,其中PermitRootLogin可以限定root用户通过ssh的登录方式,如禁止登陆、禁止密码登录、仅允许密钥登陆和开放登陆,以下是对可选项的概括:以下选项中,yes和no的功能显而易见,只是很粗暴的允许、禁止root用户进行登陆。without-password在yes的基础上,禁止了root用户使用密码登陆。

参数类别是否允许ssh登陆登录方式交互shell
yes允许没有限制没有限制
without-password允许除密码以外没有限制
forced-commands-only允许仅允许使用密钥仅允许已授权的命令
no不允许N/AN/A
喜欢 (1)
[支付宝扫码,感谢支持]
分享 (0)
关于作者:

您必须 登录 才能发表评论!