天天看点

linux root 端口,Linux 修改SSH端口 和 禁止Root远程登陆

SSH端口默认是22.但从安全方面考虑,建议修改这个端口。 端口的取值范围是0 - 65535(即2的16次方),0到1024是系统使用的端口,如 http服务的端口80。我们可以使用的端口范围:1024到65535。这个是socket规定的。

1.1修改端口配置文件

vi /etc/ssh/ssh_config

vi /etc/ssh/sshd_config

取消Port前的#注释,并将端口22改成65535

https://www.cndba.cn/Dave/article/648

1.2重启sshd服务

用root用户执行:

[[email protected] ~]# service sshd restart

Stopping sshd:[OK]

Starting sshd:[OK]

此时在用SSH连接,就需要修改ssh的端口为6535才能连接了。

二.禁用Root远程登陆

先在ssh的配置文件里修改Root远程登陆参数。 禁用root远程登陆。 然后创建一个远程登陆用户。 用这个用户登陆之后,在切换到root用户,拿到最高权限。https://www.cndba.cn/Dave/article/648

2.1创建普通权限的用户

[[email protected] ~]# useradd ruser

[[email protected] ~]# passwd ruser

Changing password for user ruser.

BAD PASSWORD: it is too short

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

[[email protected] ~]#

2.2禁止ROOT远程SSH登录

#vi /etc/ssh/sshd_config

PermitRootLogin yes

改为

PermitRootLogin no

2.3重启sshd服务

#service sshd restart

注意:这些修改不影响已经连接的SSH。只对以后的的连接产生影响。https://www.cndba.cn/Dave/article/648

注意: 如果系统开起了iptables防火墙,那么还需要把修改之后的端口号添加到防火墙里面,不然SSH会连不上。  关于防火墙端口的添加,参考我的Blog:

https://www.cndba.cn/Dave/article/648

Linux iptables 防火墙 添加删除 端口

https://www.cndba.cn/Dave/article/648

整理自网络

------------------------------------------------------------------------------

Blog:http://blog.csdn.net/tianlesoftware

网上资源:http://tianlesoftware.download.csdn.net

相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx

DBA1群:62697716(满); DBA2群:62697977(满)

DBA3群:62697850DBA超级群:63306533;

聊天 群:40132017

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

版权声明:本文为博主原创文章,未经博主允许不得转载。