2010-11-09
SSHで鍵認証設定時にエラーが起きた場合
ローカル側で公開鍵と秘密鍵を生成する。
% ssh-keygen -t rsa -b 2048 Generating public/private rsa key pair. Enter file in which to save the key (/Users/littlebuddha/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/littlebuddha/.ssh/id_rsa. Your public key has been saved in /Users/littlebuddha/.ssh/id_rsa.pub. The key fingerprint is: a1:d0:16:1a:f7:ed:5a:dc:cf:1b:87:29:2b:e4:2c:6a littlebuddha@MacBookPro.local The key's randomart image is: +--[ RSA 2048]----+ | | | =o| | o = o o.B| | . X = + .+| | . E = o o. | | o . . . . | | . | | | | | +-----------------+
公開鍵をサーバー側に転送して、公開鍵を登録する。
% ssh-keygen -i -f ~/id_rsa_2048.pub >> ~/.ssh/authorized_keys uudecode failed.
そうすると、「uudecode failed.」とエラーが出て、登録ができない。オプションを下記のものにすれば、登録はできるようになるが、パスワード入力無しの鍵認証になってしまうので、それは避けたい。
そもそも「uudecode failed.」は何かを調べたら、下記のことが原因だとわかった。
First of all, you used two dashes instead of one in the options.
Secondly, the -f option is for importing an ssh key and exporting an openssh key. If you are using openssh in both, simply:
cat mykey.pub >> .ssh/authorized_keys
If the server is running a commercial ssh server, then export the openssh key to an RFC 4716 SSH public key format:
ssh-keygen -e -f mykey.pub > my4716key.pub. The server will probably
either accept this form or be able to import it.
http://www.linuxquestions.org/questions/linux-general-1/how-can-i-import-my-rsa-key-646579/#post3172938
要するに、ローカル側とサーバー側で openssh を利用しているのならば、単に追記すれば良いようだ。
$ cat mykey.pub >> .ssh/authorized_keys
ということなので、公開鍵を追記する。
% cat ~/id_rsa.pub >> ~/.ssh/authorized_key
トラックバック - http://d.hatena.ne.jp/littlebuddha/20101109/1289306421
リンク元
- 34 http://pipes.yahoo.com/pipes/pipe.info?_id=tDfBdGWF3RGl9XNm1L3fcQ
- 12 http://www.google.co.jp/search?sourceid=navclient&hl=ja&ie=UTF-8&rlz=1T4GZAZ_jaJP266JP266&q=web+api+json
- 5 http://www.google.co.jp/search?q=perl+json&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:ja:official&hl=ja&client=firefox-a
- 5 http://www.google.com/search?hl=ja&lr=lang_ja&ie=UTF-8&oe=UTF-8&q=jquery+jsonp&num=50
- 4 http://d.hatena.ne.jp/notify-Notify_user_ifilter?aHR0cDovL2QuaGF0ZW5hLm5lLmpwL2xpdHRsZWJ1ZGRoYS8yMDA4MTAyMi8xMjI0NjQ1MTk5
- 4 http://www.google.co.jp/search?hl=ja&lr=&safe=off&client=firefox-a&rls=org.mozilla:ja-JP-mac:official&channel=s&q=ruby+1.9+文字コード&aq=2c&aqi=g-c10&aql=&oq=rub+文字コード&gs_rfai=
- 3 http://www.google.co.jp/
- 3 http://www.google.co.jp/search?hl=ja&lr=lang_ja&tbs=lr:lang_1ja&q=波ダッシュ+正規表現&aq=f&aqi=&aql=&oq=&gs_rfai=
- 3 http://www.google.co.jp/search?hl=ja&q=cpan+mechanize+mac&aq=f&aqi=&aql=&oq=&gs_rfai=
- 3 http://www.google.co.jp/search?hl=ja&safe=off&client=firefox-a&hs=1eX&rlz=1R1GGGL_ja___JP321&&sa=X&ei=Y37ZTLLvBIzqvQOa6tXOCQ&ved=0CBYQBSgA&q=Encode+decode+関数&spell=1

