ssh禁止root用户登录

简介: 查看ssh服务是否安装  [root@localhost ~]# rpm -qa |grep -E '(ssh.*server|server.*ssh)' openssh-server-5.
查看ssh服务是否安装 

[root@localhost ~]# rpm -qa |grep -E '(ssh.*server|server.*ssh)'
openssh-server-5.3p1-70.el6.i686

查看配置文件
[root@localhost ~]# rpm -qc openssh-server
/etc/pam.d/ssh-keycat
/etc/pam.d/sshd
/etc/ssh/sshd_config
/etc/sysconfig/sshd
man手册查看禁止root登录的选项
[root@localhost ~]# man /etc/ssh/sshd_config
[root@localhost ~]# vim /etc/ssh/sshd_config
PermitRootLogin no

验证
[10:22:20 talen@BJB0300 ~ ]$ ssh -l root 192.168.74.129
root@192.168.74.129's password: 
Permission denied, please try again.
root@192.168.74.129's password: 

[10:22:48 talen@BJB0300 ~ ]$ ssh -l talen 192.168.74.129
talen@192.168.74.129's password: 
[talen@localhost ~]$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos

root用户无法登录,普通用户可以登录
目录
相关文章
|
安全 网络安全 数据安全/隐私保护
Debian 12系统中允许Root远程SSH登录解决方法!
在 Debian 12 系统中开启 SSH 远程 Root 登录需修改 SSH 配置文件 (`sshd_config`),将 `PermitRootLogin` 设置为 `yes` 并确保密码认证启用。完成后重启 SSH 服务并验证连接。若防火墙启用,需放行端口 22。注意,直接开放 Root 登录可能带来安全风险,建议使用普通用户登录后切换至 Root。
2247 1
|
监控 Ubuntu 安全
debian或Ubuntu中开启ssh允许root远程ssh登录的方法
在Debian或Ubuntu系统中启用root用户的SSH远程登录需要编辑SSH配置文件、设置root密码并重启SSH服务。虽然这可以在某些情况下提供便利,但必须注意安全性,通过使用强密码、限制IP访问、使用SSH密钥认证等方法来保护服务器的安全。
8004 5
|
安全 Linux 网络安全
|
Linux 网络安全 数据安全/隐私保护
Jun 03 14:50:45 nodeName sshd[60215]: Accepted password for root from 192.168.0.100 port 15612 ssh2 如何关闭这个连接
【6月更文挑战第6天】Jun 03 14:50:45 nodeName sshd[60215]: Accepted password for root from 192.168.0.100 port 15612 ssh2 如何关闭这个连接
386 2
|
Ubuntu Linux 网络安全
在Linux中,如何禁用root用户直接SSH登录?
在Linux中,如何禁用root用户直接SSH登录?
|
网络安全 数据安全/隐私保护
银河麒麟v10系统SSH远程管理及切换root用户的操作方法
银河麒麟v10系统SSH远程管理及切换root用户的操作方法
10847 0
|
网络安全
无法启动ssh:/run/sshd must be owned by root and not group or world-writable.
无法启动ssh:/run/sshd must be owned by root and not group or world-writable.
593 0
无法启动ssh:/run/sshd must be owned by root and not group or world-writable.
|
Ubuntu Linux 网络安全
Ubuntu18.04.6 配置固定ip、ssh登录、root账号
Ubuntu18.04.6 配置固定ip、ssh登录、root账号
820 0
|
安全 Ubuntu Java
服务器搭建(1)——从购买云服务器到修改SSH端口、禁用ROOT远程登录
服务器搭建(1)——从购买云服务器到修改SSH端口、禁用ROOT远程登录
573 0
|
Linux Shell 网络安全
【Linux】——在Xshell输入ssh root@公网ip进行远程连接Linux失败,显示(port 22): Connection failed的完美解决方法
【Linux】——在Xshell输入ssh root@公网ip进行远程连接Linux失败,显示(port 22): Connection failed的完美解决方法
2158 0