ssh
サーバーでsshが動作しているか確認する
ルーターで ポート22を通過させる そして次のように確認
26#telnet 192.168.1.2 22
Trying 192.168.1.2...
Connected to fsv.972432.com.
Escape character is '^]'.
SSH-1.99-OpenSSH_3.5p1 FreeBSD-20030924
ssh のヴァージョンを確認
>ssh -v
OpenSSH_3.5p1 FreeBSD-20030924, SSH protocols 1.5/2.0, OpenSSL
0x0090704f
SSHの分類
OpenSSHとSSH,Protocol 1とProtocol 2 がある
(OpenSSH Protocol 2) に (SSH Protocol 1)
(SSH Protocol 2)
でlogin する場合等があり 設定が必要
sshd2_config 等をみる
鍵の生成
鍵の配置
|
公開鍵 |
秘密鍵 |
| SSH1 |
~/.ssh/authorized_keys |
~/.ssh/identity |
| OpenSSH1 |
~/.ssh/authorized_keys |
~/.ssh/identity |
| SSH2 |
~/.ssh2/authorizationで指定 |
~/.ssh2/identificationで指定 |
| OpenSSH2 |
~/.ssh/authorized_keys |
~/.ssh/id_dsa
~/.ssh/id_rsa |
OpenSSH1 の鍵生成
% ssh-keygen -b 1024 -t rsa1
SSH1の ssh-keygen を使って,鍵の生成を行ないます.
% ssh-keygen1
OpenSSHの ssh-keygenを使って,鍵の生成を行ないます.
% ssh-keygen -b 1024 -t dsa
サーバーの rc.conf sshの有効化
sshd_enable="YES"
サーバーに abc と言うuserを作って そこに sshでroginする
基本的に クライアントで
公開鍵と秘密鍵を作って サーバーの
/home/abc/.ssh/authorized_keys にid_rsa.pubの内容を置く
SSH プロトコル 2 対応 dsa 鍵ペアの場合
userが
>ssh-keygen -t dsa で
id_rsa
id_rsa.pub を作る id_rsa.pubの内容を
サーバーの /home/abc/.ssh にauthorized_keys と言うファイルを作り
コピーしたら良い
id_rsa.pubの内容 例
ssh-rsa AAAAB3p8hXXxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxR6dgMUxdxTQFM= kaz@hita.972432.com(クライアントのホストのuser ;kaz)
のようになっている
バージョン2.0対応のRSA鍵ペアの生成
ssh-keygen -t rsa
scpコマンド
scp localfile username@tohostname:/newfilename
です。localfileには転送元
転送元ファイルとして複数のファイルを指定できます
scp /downloads/*
username
@penguin.example.net:/uploads/
http://www.openssh.com/ja/
http://www.momonga-linux.org/docs/OpenSSH-HOWTO/ja/index.html 参照