« ファイルを暗号化された経路で転送 | メイン | 8人から2チーム対抗ゴルフゲームの組み合わせ »

OS

ファイルを暗号化された経路で転送 バッチ準備編

参考→sshでパスワードなしに
http://www.atmarkit.co.jp/flinux/rensai/linuxtips/447nonpassh.html
●サーバ作業
[taro@server ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/taro/.ssh/id_rsa):
Created directory '/home/taro/.ssh'.
Enter passphrase (empty for no passphrase):英語の合言葉
Enter same passphrase again:英語の合言葉
Your identification has been saved in /home/taro/.ssh/id_rsa.
Your public key has been saved in /home/taro/.ssh/id_rsa.pub.
The key fingerprint is:
c5:d2:7a:31:7a:58:d3:cf:a5:7f:8f:48:16:0a:f9:3e taro@server
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|         o .     |
|        . O .   .|
|         O + o o |
|        S o . +  |
|         = . . . |
|          o o   o|
|         .Eo . .o|
|          ... . .|
+-----------------+
[taro@server ~]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[taro@server ~]$ chmod 600 ~/.ssh/authorized_keys
サーバー作業は以上、
クライアント作業
[taro@localhost taro]$ scp taro@192.168.0.1:.ssh/id_rsa .
taro@192.168.0.1's password:
id_rsa                                 100% 1743     1.7KB/s   00:00
[taro@localhost taro]$ eval `ssh-agent`
Agent pid 2489
[taro@localhost taro]$ ssh-add ~/id_rsa
Enter passphrase for /home/taro/id_rsa:英語の合言葉
Identity added: /home/taro/id_rsa (/home/taro/id_rsa)
[taro@localhost taro]$ rm ~/id_rsa
ssh-agentを終了するまでの間パスワード入力なしで転送可能
[taro@localhost taro]$ scp taro@192.168.0.1:address.txt .
address.txt                            100% 1743     1.7KB/s   00:00
[taro@localhost taro]$ eval `ssh-agent -k`
Agent pid 2489 killed
http://www.itmedia.co.jp/help/tips/linux/l0404.html
http://www.itmedia.co.jp/help/tips/linux/l0403.html

トラックバック

このエントリーのトラックバックURL:
https://www.remix.asia/cgi/mt/mt-tb.cgi/6754

コメントを投稿

(いままで、ここでコメントしたことがないときは、コメントを表示する前にこのブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)