ssh 自動ログイン
sshで自動ログインしたい
1.公開キー作成(dsa/rsa)
とりあえず、abcユーザでdsa/rsaをpassなしで作成。
mkdir .ssh
chmod 700
abc@sv:~/.ssh$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/abc/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/abc/.ssh/id_dsa.
Your public key has been saved in /home/abc/.ssh/id_dsa.pub.
The key fingerprint is:
aa:bb:cc:dd:dd:ee:ff:gg:ss:ww:ss:ss:ff:aa:aa:cc abc@sv
The key's randomart image is:
+--[ DSA 1024]----+
| . ooo |
| +.o . |
| . . . .|
| o . . o |
| = S o + |
| . = . . + . |
| E . . + |
| . + o |
| o.o |
+-----------------+
abc@sv:~/.ssh$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/abc/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/abc/.ssh/id_rsa.
Your public key has been saved in /home/abc/.ssh/id_rsa.pub.
The key fingerprint is:
aa:bb:cc:dd:dd:ee:ff:gg:ss:ww:ss:ss:ff:aa:aa:cc abc@sv
The key's randomart image is:
+--[ RSA 2048]----+
|o++o+*...o+.o |
| .+oo = .. o . |
| o E .. . |
| o . o. |
| o S |
| |
| |
| |
| |
+-----------------+
2.相手さんの.sshにそれぞれコピーして、id_dsa.pub/id_rsa.pub
cat id_dsa.pub >> .ssh/authorized_keys2
chmod 600 .ssh/authorized_keys2
rm id_dsa.pub
cat id_rsa.pub >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
rm id_rsa.pub
それでssh ***@ipとすると自動でログイン。
カテゴリ内の記事
- qmailでバーチャルドメインを構築しよう(その1)(2005/10/04)
- qmailでバーチャルドメインを構築しよう(その2)(2005/10/04)
- qmailでバーチャルドメインを構築しよう(その3 vpopmail編)(2005/10/04)
- qmailでバーチャルドメイン構築(その4 courier-imap authlib編)(2005/10/04)
- qmailでバーチャルドメイン構築(その5通信暗号化)(2005/10/04)
- qmail+tcpserverでメールの送信が遅い時・・・(2005/10/04)
- 第三者証明付きSSLを作る(2006/06/05)
- linux での iptables(2006/06/19)
- linux でのパスワード忘れなどtips(2006/06/20)
- apache/php で バージョン非表示(2006/06/23)
- qmail sendmail SMTPプロトコル(2006/07/13)
- Postgresqlのデータベースバックアップ(2006/07/23)
- HTTP レスポンスヘッダの Apache バージョンを非表示にする(2008/03/24)
- Postfix のキュー削除(2008/04/16)
- mysql charset(2008/04/25)
- mysql charset(2008/04/25)
- apache ssi(2008/07/26)
- postfix:ヘッダをみてメールをドロップする(2009/05/28)
- apache2でモジュールをロードする(2009/07/06)
- mysqlのバックアップ、リストア(2009/07/06)
- ssh 自動ログイン(2009/07/07)
- sshでIP制限、ポート変更root拒否(2009/07/07)
- wordpress重い(2009/08/18)
- mysql リモート許可(2009/10/09)
- mysql utf8(2010/02/03)
