歡迎您光臨本站 註冊首頁

linux伺服器secureCRT RSA登錄配置

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0

為了保證生產伺服器的安全,我們會做一些安全的登錄驗證措施!不允許使用root賬號直接登錄伺服器!下面是通過secureCRT 設置RSA登錄配置.

1、RSA公鑰配置方法 Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE MicrosoftInternetExplorer4


1)打開secureCRT 選擇一個連接然後點屬性再如圖所示

(2)一直點下去 點擊下一步

要選RSA,然後下一步

輸入密碼(公鑰密碼可以簡單一些),繼續下一步

Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE

MicrosoftInternetExplorer4

[root@localhost /]# useradd test

[root@localhost /]#passwd test

@註:如果不為test用戶設置密碼,後果就是系統默認test用戶是鎖死的!所以就不會成功了

2)在用戶目錄

(/home/test)下建立.ssh目錄

[root@localhost /]# mkdir /home/test/.ssh

3)將secureCrt生成的公鑰(fileName.pub)上傳到/home/test/.ssh

目錄下

文件是相同名字的兩個都要上傳

.ssh是隱藏的,ls下看不到,cd .ssh可以進去

4)修改用戶目錄屬性

[root@localhost /]# chown –R test:test /home/test

[root@localhost /]# chmod –R 755 /home/test

chown –R test:test /home/test

這一句話的意思是說把/home/test這個目錄許可權給test這個用戶組的test用戶

5)將/etc/ssh/sshd_config備份到/etc/ssh/sshd_config.bak

[root@localhost /]#cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

6)修改

/etc/ssh/sshd_config,修改參數如下

a) RSAAuthentication yes

b) AuthorizedKeysFile .ssh/fileName.pub

c) PermitRootLogin no(不允許Root直接遠程登入)

d) PasswordAuthentication no(不允許密碼驗證方式登入)

e) UsePAM no(所有用戶都不能用密碼方式登入,如果此選擇為yes,則非Root用戶可以用密碼驗證的方式登入)

(7) /home下寫名為

ssh.sh的腳本,寫此腳本的目的是為了防止更新配置后無法連接伺服器.內容如下(註:此自動執行腳本要在所有配置完成後再放到自動執行內,時間可能適當延長)

#!/bin/sh

cd /etc/ssh/

cat sshd_config.bak > sshd_config

/etc/init.d/sshd restart

寫完后將此腳本許可權改成可執行許可權.

[root@localhost /]# chmod x /home/ssh.sh

ps -efww|grep /usr/sbin/sshd |grep -v grep|cut -c 9-15|xargs kill -9

8)在crontab里寫入一條五分鐘后自動執行的語句(*/5 * * * * /home/ssh.sh)

9)重新啟動sshd

[root@localhost /]# /etc/init.d/sshd restart

伺服器端配置完成.

本文出自 「我菜故我在」 博客,請務必保留此出處http://strugglelinux.blog.51cto.com/1009905/779867


[火星人 ] linux伺服器secureCRT RSA登錄配置已經有526次圍觀

http://coctec.com/docs/linux/show-post-47084.html