精華區beta FreeBSD 關於我們 聯絡資訊
[SSH2 Use ssh-keygen2 Authentication][FreeBSD] 前言 網路上除了永遠的UNIX是 ssh2 的key認証登入 大部份都是 ssh 而已 ^^; 寫出本文只是讓自己方便一點 ^^ 你需要有 兩個 FreeBSD 帳號 已安裝並啟動 ssh2 ( ex : portinstall ssh2 && killall sshd && sshd2 & ) 本文 帳號A 金鑰認証登入 帳號B step1 建立金鑰 帳號A $ ssh-keygen2 會跑一堆..預設是跑 2048bit dsa key出來 會放在 ~/.ssh2/ 裡 .. 預設檔名是 id_dsa_2048_a & id_dsa_2048_a.pub ( man ssh-keygen2 ) step2 將A的auth link (pri) 建好 先確認 id_dsa_2048_a 在 ~/.ssh2/ 然後 echo "IdKey id_dsa_2048_a" > identification # 把 IdKey id_dsa_2048_a 寫入 ident ification 記得 chmod 600 identification 降子就建好pri key的連結了 step3 將B的auth link ( pub ) 建好 將 *pub 丟到 B 的 ~/.ssh2/ 然後建一檔案 authorization 然後 echo "Key id_dsa_2048_a.pub" > authorization # 把 Key id_dsa_2048_a.pub 寫入 au thorization ok! step4 測試 帳號 A $ ssh2 帳號B的domainname sample : t2@www[ ~/.ssh2 ] # ssh2 domainname Authentication successful. Last login: Sat Nov 15 2003 17:45:25 +0800 from IP FreeBSD 4.9-STABLE (T) #1: Tue Nov 4 12:43:41 CST 2003 Welcome to FreeBSD! You have mail. t2@t2[~]$ 完成! 結論 主要是測試 rsync + ssh 所以才寫的啦 但是 rsync 測試還沒弄好.. 最終目標是要做異地備援啦 :~ 參考資料(或文獻) http://www.fanqiang.com/a6/b9/20010625/170400665_b.html 提醒您: 以上教學只是我(賊二)自己的一些小方法提出來讓大家參考的, 如果照著發生您機器的任何損壞(如硬碟暴了啊,cpu燒了啊等等等) 本人不能付任何負責的,請使用前想清楚唷…ccc 有錯請指教,謝謝 ^^ 賊二教學注意事項: $ XXX <-- 請您打 XXX 或同等之指令 ^^ # 之後是注解 (基本上都是我的廢話比較多啦 : >) -- ┌─────────────────┐ │I tried so hard,And got so far, ╔──────────── But in the end,It doesn't even matter, In the end - Linkin Park └────────────────┐ ────────────╝ I had to fall,To lose it all,But in the end,It doesn't even matter.│ └──────────────────────────────────┘ -- ┌ OriGin: 創 世 紀 ─── cte.twbbs.org ─── 140.113.222.140 ───┐ └ Post_By: [thieftwo ] ────── From: 61-230-244-134.HIN ──┘ > -------------------------------------------------------------------------- < 發信人: [email protected] (賊二啊。), 看板: FreeBSD 標 題: Re: [SSH2 Use ssh-keygen2 Authentication][FreeBSD] 發信站: 創世紀 (Sat Nov 15 22:29:29 2003) 轉信站: ptt!ctu-reader!ctu-peer!news.nctu!netnews.csie.nctu!freebsd.ntu!bbs.ee 因為之前內建的 ssh 出現問題 @@? 裝ports更新比make world快的關係... ※ 引述《[email protected] (o_O)》之銘言: > ※ 引述《[email protected] (賊二啊。)》之銘言: > > ( ex : portinstall ssh2 && killall sshd && sshd2 & ) > 我想問一下,為什麼要另外裝 ssh.com 的 ssh 呢? > build-in 的不好嗎? :) > -------------------------------------------------------------------------- < 發信人: [email protected] (o_O), 看板: FreeBSD 標 題: Re: [SSH2 Use ssh-keygen2 Authentication][Free … 發信站: 小鹿鹿 BBS (Sun Nov 16 17:27:37 2003) 轉信站: ptt!ctu-reader!news.nctu!abpe.org ※ 引述《[email protected] (好小孩)》之銘言: > ※ 引述《[email protected] (賊二啊。)》之銘言: > : 因為之前內建的 ssh 出現問題 @@? > : 裝ports更新比make world快的關係... > 那如果重新抓取 source ,在 /usr/src/crypto/openssh 底下 make 呢? :) cd /usr/src/secure/lib/libssh make clean && make depend && make all install cd /usr/src/secure/usr.sbin/sshd make clean && make depend && make all install cd /usr/src/secure/usr.bin/ssh make clean && make depend && make all install kill -9 `cat /var/run/sshd.pid` /usr/sbin/sshd > -------------------------------------------------------------------------- < 作者: psilotum (好小孩) 看板: FreeBSD 標題: Re: [SSH2 Use ssh-keygen2 Authentication][Free … 時間: Sun Nov 16 21:51:56 2003 ※ 引述《[email protected] (o_O)》之銘言: : ※ 引述《[email protected] (好小孩)》之銘言: : > 那如果重新抓取 source ,在 /usr/src/crypto/openssh 底下 make 呢? :) : cd /usr/src/secure/lib/libssh : make clean && make depend && make all install : cd /usr/src/secure/usr.sbin/sshd : make clean && make depend && make all install : cd /usr/src/secure/usr.bin/ssh : make clean && make depend && make all install : kill -9 `cat /var/run/sshd.pid` : /usr/sbin/sshd uh~.... 終於知道為什麼了..難怪之前都無法 make ... 在 /usr/src/crypto 底下的 README 寫得很清楚 :P $FreeBSD: src/crypto/README,v 1.2.2.2 2001/02/10 04:48:38 kris Exp $ This directory is for the EXACT same use as src/contrib, except it holds crypto sources. In other words, this holds raw sources obtained from various third party vendors, with FreeBSD patches applied. No compilation is done from this directory, it is all done from the src/secure directory. The separation between src/contrib and src/crypto is the result of an old USA law, which made these sources export controlled, so they had to be kept separate. 謝謝 :D