<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        限制用戶通過ssh密鑰進行認證登陸

        來源:懂視網(wǎng) 責編:小采 時間:2020-11-09 08:22:28
        文檔

        限制用戶通過ssh密鑰進行認證登陸

        限制用戶通過ssh密鑰進行認證登陸:為了服務器和 用戶 的安全,禁止 用戶 密碼的 認證 方式,而基于鑰匙的方式。 Lastlogin:FriOct1214:14:012012from192.168.7.251 root@Cacti.Nagios:[/root] vi/etc/ssh/sshd_config #$OpenBSD:sshd_config,v1.8
        推薦度:
        導讀限制用戶通過ssh密鑰進行認證登陸:為了服務器和 用戶 的安全,禁止 用戶 密碼的 認證 方式,而基于鑰匙的方式。 Lastlogin:FriOct1214:14:012012from192.168.7.251 root@Cacti.Nagios:[/root] vi/etc/ssh/sshd_config #$OpenBSD:sshd_config,v1.8

        為了服務器和 用戶 的安全,禁止 用戶 密碼的 認證 方式,而基于鑰匙的方式。 Lastlogin:FriOct1214:14:012012from192.168.7.251 root@Cacti.Nagios:[/root] vi/etc/ssh/sshd_config #$OpenBSD:sshd_config,v1.802008/07/0202:24:18djmExp$ #Thisisthesshdse

        為了服務器和用戶的安全,禁止用戶密碼的認證方式,而基于“鑰匙”的方式。

        1. Last login: Fri Oct 12 14:14:01 2012 from 192.168.7.251
        2. root@Cacti.Nagios:[/root]vi /etc/ssh/sshd_config
        3. # $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
        4. # This is the sshd server system-wide configuration file. See
        5. # sshd_config(5) for more information.
        6. # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
        7. # The strategy used for options in the default sshd_config shipped with
        8. # OpenSSH is to specify options with their default value where
        9. # possible, but leave them commented. Uncommented options change a
        10. # default value.
        11. #Port 22
        12. #AddressFamily any
        13. #ListenAddress 0.0.0.0
        14. #ListenAddress ::
        15. # Disable legacy (protocol version 1) support in the server for new
        16. # installations. In future the default will change to require explicit
        17. # activation of protocol 1
        18. Protocol 2 ← 修改后變?yōu)榇藸顟B(tài),僅使用SSH2
        19. # HostKey for protocol version 1
        20. #HostKey /etc/ssh/ssh_host_key
        21. # HostKeys for protocol version 2
        22. #HostKey /etc/ssh/ssh_host_rsa_key
        23. #HostKey /etc/ssh/ssh_host_dsa_key
        24. # Lifetime and size of ephemeral version 1 server key
        25. #KeyRegenerationInterval 1h
        26. #ServerKeyBits 1024
        27. # Logging
        28. # obsoletes QuietMode and FascistLogging
        29. #SyslogFacility AUTH
        30. SyslogFacility AUTHPRIV
        31. #LogLevel INFO
        32. # Authentication:
        33. #LoginGraceTime 2m
        34. #PermitRootLogin yes
        35. PermitRootLogin no ← 修改后變?yōu)榇藸顟B(tài),不允許用root進行登錄
        36. #StrictModes yes
        37. #MaxAuthTries 6
        38. #MaxSessions 10
        39. #RSAAuthentication yes
        40. #PubkeyAuthentication yes
        41. #AuthorizedKeysFile .ssh/authorized_keys
        42. #AuthorizedKeysCommand none
        43. #AuthorizedKeysCommandRunAs nobody
        44. # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
        45. #RhostsRSAAuthentication no
        46. # similar for protocol version 2
        47. #HostbasedAuthentication no
        48. # Change to yes if you don't trust ~/.ssh/known_hosts for
        49. # RhostsRSAAuthentication and HostbasedAuthentication
        50. #IgnoreUserKnownHosts no
        51. # Don't read the user's ~/.rhosts and ~/.shosts files
        52. #IgnoreRhosts yes
        53. # To disable tunneled clear text passwords, change to no here!
        54. #PasswordAuthentication yes
        55. PasswordAuthentication no ← 修改后變?yōu)榇藸顟B(tài),不允許密碼方式的登錄
        56. #PermitEmptyPasswords no
        57. PermitEmptyPasswords no ← 修改后變?yōu)榇藸顟B(tài),禁止空密碼進行登錄
        58. "/etc/ssh/sshd_config" 141L, 3941C written
        59. root@Cacti.Nagios:[/root]vi /etc/hosts.deny ← 修改屏蔽規(guī)則,在文尾添加相應行
        60. #
        61. # hosts.deny This file contains access rules which are used to
        62. # deny connections to network services that either use
        63. # the tcp_wrappers library or that have been
        64. # started through a tcp_wrappers-enabled xinetd.
        65. #
        66. # The rules in this file can also be set up in
        67. # /etc/hosts.allow with a 'deny' option instead.
        68. #
        69. # See 'man 5 hosts_options' and 'man 5 hosts_access'
        70. # for information on rule syntax.
        71. # See 'man tcpd' for information on tcp_wrappers
        72. #
        73. sshd:ALL ← 添加這一行,屏蔽來自所有的SSH連接請求
        74. "/etc/hosts.deny" 14L, 469C written
        75. You have new mail in /var/spool/mail/root
        76. root@Cacti.Nagios:[/root]vi /etc/hosts.allow ← 修改允許規(guī)則,在文尾添加相應行
        77. #
        78. # hosts.allow This file contains access rules which are used to
        79. # allow or deny connections to network services that
        80. # either use the tcp_wrappers library or that have been
        81. # started through a tcp_wrappers-enabled xinetd.
        82. #
        83. # See 'man 5 hosts_options' and 'man 5 hosts_access'
        84. # for information on rule syntax.
        85. # See 'man tcpd' for information on tcp_wrappers
        86. #
        87. sshd:192.168.7. 只允許192.168.7。網(wǎng)段的機器ssh登陸
        88. ~
        89. ~
        90. ~
        91. "/etc/hosts.allow" 11L, 386C written
        92. root@Cacti.Nagios:[/root]su - admin
        93. admin@Cacti.Nagios:[/data]ssh-keygen -t rsa
        94. Generating public/private rsa key pair.
        95. Enter file in which to save the key (/data/.ssh/id_rsa):
        96. Created directory '/data/.ssh'.
        97. Enter passphrase (empty for no passphrase):
        98. Enter same passphrase again:
        99. Your identification has been saved in /data/.ssh/id_rsa.
        100. Your public key has been saved in /data/.ssh/id_rsa.pub.
        101. The key fingerprint is:
        102. e5:15:ba:be:59:ef:2e:74:df:b6:ee:e1:6a:24:be:da admin@Cacti.Nagios
        103. The key's randomart image is:
        104. +--[ RSA 2048]----+
        105. | . |
        106. | . . |
        107. | o . |
        108. | o o |
        109. | S o |
        110. | . .... |
        111. | o.+. o.|
        112. | .=.o. =|
        113. | .+Eo=B*.|
        114. +-----------------+
        115. admin@Cacti.Nagios:[/data]ls -a
        116. . .. .bash_history .bash_logout .bash_profile .bashrc lost+found .ssh .viminfo
        117. admin@Cacti.Nagios:[/data]cd .ssh/
        118. admin@Cacti.Nagios:[/data/.ssh]ll
        119. total 8
        120. -rw------- 1 admin admin 1751 Oct 12 17:19 id_rsa
        121. -rw-r--r-- 1 admin admin 401 Oct 12 17:19 id_rsa.pub
        122. admin@Cacti.Nagios:[/data/.ssh]cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
        123. admin@Cacti.Nagios:[/data/.ssh]ls -a
        124. . .. authorized_keys id_rsa id_rsa.pub
        125. admin@Cacti.Nagios:[/data/.ssh]chmod 400 authorized_keys
        126. admin@Cacti.Nagios:[/data/.ssh]ll -a
        127. total 20
        128. drwx------ 2 admin admin 4096 Oct 12 17:20 .
        129. drwxr-xr-x 4 admin admin 4096 Oct 12 17:19 ..
        130. -r-------- 1 admin admin 401 Oct 12 17:20 authorized_keys
        131. -rw------- 1 admin admin 1751 Oct 12 17:19 id_rsa
        132. -rw-r--r-- 1 admin admin 401 Oct 12 17:19 id_rsa.pub
        133. 至此,將私鑰id_rsa導出到windows客戶端上。然后刪除生成的公鑰id_rsa.pub。
        134. 重啟sshd服務,使得剛才所做的配置修改生效。
        135. root@Cacti.Nagios:[/root]/etc/rc.d/init.d/sshd restart Stopping sshd: [ OK ] Starting sshd: [ OK ]

        蟲子的博客

        聲明:本網(wǎng)頁內容旨在傳播知識,若有侵權等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        限制用戶通過ssh密鑰進行認證登陸

        限制用戶通過ssh密鑰進行認證登陸:為了服務器和 用戶 的安全,禁止 用戶 密碼的 認證 方式,而基于鑰匙的方式。 Lastlogin:FriOct1214:14:012012from192.168.7.251 root@Cacti.Nagios:[/root] vi/etc/ssh/sshd_config #$OpenBSD:sshd_config,v1.8
        推薦度:
        標簽: 登錄 用戶 驗證
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 成人毛片18女人毛片免费| 日本高清免费观看| 免费无码又爽又刺激毛片| 亚洲三级视频在线| 91免费国产在线观看| 亚洲成无码人在线观看| www视频免费看| 亚洲影视自拍揄拍愉拍| 免费人成在线视频| 色天使色婷婷在线影院亚洲| 国产精品免费视频一区| 男女午夜24式免费视频| 亚洲av日韩av不卡在线观看| 免费91最新地址永久入口 | 久久99亚洲网美利坚合众国 | 亚洲片一区二区三区| 一级视频免费观看| 亚洲色爱图小说专区| 99热免费在线观看| 最新亚洲精品国偷自产在线| 在线播放高清国语自产拍免费| 老司机午夜免费视频| 久草视频免费在线观看| 亚洲色www永久网站| 国产免费私拍一区二区三区| 国产免费人成视频尤勿视频| 色播亚洲视频在线观看| 成人毛片免费网站| ssswww日本免费网站片| 亚洲国产一区国产亚洲 | 亚洲欧洲专线一区| 亚洲国产精品人人做人人爱| 精品国产免费一区二区三区香蕉| 亚洲乱码中文论理电影| 免费在线观看视频a| 永久黄色免费网站| 亚洲精品视频在线观看视频| 四虎成人精品一区二区免费网站| 亚洲第一视频在线观看免费| 亚洲韩国在线一卡二卡| 亚洲成av人片不卡无码久久|