Chinaunix首页 | 论坛 | 博客
  • 博客访问: 285230
  • 博文数量: 93
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 830
  • 用 户 组: 普通用户
  • 注册时间: 2016-02-25 10:44
个人简介

一杯茶,一台电脑

文章分类

全部博文(93)

文章存档

2018年(4)

2017年(57)

2016年(32)

分类: LINUX

2016-05-30 12:39:07

平时自己的本地Linux可能不需要配制SSH端口,但是在服务器的SSH端口为了安全起见,就不得不配制了,目前我接触过的发行版本(Ubuntu CenterOS)只要是安装了SSH服务的,都是在/etc/ssh/sshd_config文件当中进行配制;
如我家里的Ubuntu的如下图:

点击(此处)折叠或打开

  1. 下面的是SSH软件目录
  2. drwxr-xr-x 2 root root 4096 5月 29 13:26 .
  3. drwxr-xr-x 141 root root 12288 5月 30 11:13 ..
  4. -rw-r--r-- 1 root root 300261 4月 16 13:18 moduli
  5. -rw-r--r-- 1 root root 1756 4月 16 13:18 ssh_config
  6. -rw-r--r-- 1 root root 2542 5月 29 13:26 sshd_config
  7. -rw------- 1 root root 668 5月 29 13:26 ssh_host_dsa_key
  8. -rw-r--r-- 1 root root 618 5月 29 13:26 ssh_host_dsa_key.pub
  9. -rw------- 1 root root 227 5月 29 13:26 ssh_host_ecdsa_key
  10. -rw-r--r-- 1 root root 190 5月 29 13:26 ssh_host_ecdsa_key.pub
  11. -rw------- 1 root root 419 5月 29 13:26 ssh_host_ed25519_key
  12. -rw-r--r-- 1 root root 110 5月 29 13:26 ssh_host_ed25519_key.pub
  13. -rw------- 1 root root 1675 5月 29 13:26 ssh_host_rsa_key
  14. -rw-r--r-- 1 root root 410 5月 29 13:26 ssh_host_rsa_key.pub
  15. -rw-r--r-- 1 root root 338 5月 29 13:26 ssh_import_id
  16. barneyx@barneyx-virtual-machine:/etc/ssh$ vim sshd_config
  17. # Package generated configuration file
  18. # See the sshd_config(5) manpage for details
  19. # What ports, IPs and protocols we listen for
  20. Port 22  #这里就是默认的SSH服务端口号
  21. # Use these options to restrict which interfaces/protocols sshd will bind to
  22. #ListenAddress ::
  23. #ListenAddress 0.0.0.0
  24. Protocol 2
  25. # HostKeys for protocol version 2
  26. HostKey /etc/ssh/ssh_host_rsa_key
  27. HostKey /etc/ssh/ssh_host_dsa_key
  28. HostKey /etc/ssh/ssh_host_ecdsa_key
  29. HostKey /etc/ssh/ssh_host_ed25519_key
  30. #Privilege Separation is turned on for security
  31. UsePrivilegeSeparation yes
  32. # Lifetime and size of ephemeral version 1 server key
  33. KeyRegenerationInterval 3600
  34. ServerKeyBits 1024
  35. # Logging
  36. SyslogFacility AUTH
  37. LogLevel INFO
  38. # Authentication:
  39. LoginGraceTime 120
  40. PermitRootLogin prohibit-password
  41. StrictModes yes
  42. RSAAuthentication yes
  43. PubkeyAuthentication yes
  44. #AuthorizedKeysFile %h/.ssh/authorized_keys
修改完成后,直接重启一下计算机,如果防火墙开启了,配制放行这个端口号-不然可能.........
阅读(833) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~