ubuntu 14.04 开启root 用户 修改ssh端口

Linux中SSH默认端口为22,为了安全考虑,我们有必要对22端口进行修改,现修改端口为60000;修改方法如下:
在/etc/ssh/sshd_config中找到Port 22,将其修改为60000,或使用/usr/sbin/sshd -p 60000指定端口。

如果用户想让22和60000端口同时开放,只需在/etc/ssh/sshd_config增加一行内容如下:
[root@localhost /]# vi /etc/ssh/sshd_config
Port 22
Port 60000
保存并退出
[root@localhost /]#service ssh restart


Ubuntu 14.04使用的ssh在安全性上与老版本有所不同,不仅需要给root设置密码,还需要修改ssh配置允许使用root登录



1. 修改 root 密码


sudo passwd root
2. 以其他账户登录,修改 /etc/ssh/sshd_config :


xxx@ubuntu14:~$ su - root
Password:
root@ubuntu14:~# vi /etc/ssh/sshd_config
3. 注释掉 #PermitRootLogin without-password,添加 PermitRootLogin yes


# Authentication:
LoginGraceTime 120
#PermitRootLogin without-password
PermitRootLogin yes
StrictModes yes
4. 重启 ssh  服务


root@ubuntu14:~# service ssh restart
ssh stop/waiting
ssh start/running, process 1499
root@ubuntu14:~#
 

你可能感兴趣的:(ubuntu 14.04 开启root 用户 修改ssh端口)