SSHでリモートアクセス - TurboLinux 7 Serverの設定

Last Modified: 2004.02.18

3. 公開鍵のコピー
以下、リモートからログインするユーザを、"toto"とする。

~/.sshディレクトリを作成し、その中に作成したauthorized_keysファイルに、公開鍵・秘密鍵の作成で作成した公開鍵 "identity.pub"の内容を追加する。自分以外のアクセス権はなしに設定する。

 [toto@linux toto]$ mkdir .ssh
 [toto@linux toto]$ chmod 700 .ssh
 [toto@linux toto]$ cd .ssh
 [toto@linux .ssh]$ ネットワーク経由のSamba等で、ここにWindows Note PCのidentity.pubファイルをコピーする。
 [toto@linux .ssh]$ cat identity.pub >> authorized_keys
 [toto@linux .ssh]$ chmod 600 *


4. sshdの設定
TurboLinux 7 Serverの基本的な設定が終わっていること、sshdが動作していないことが前提です。

1. /etc/ssh/sshd_configファイルの編集


 PermitRootLogin                 no     <--- rootは許可しない
 AllowUsers                      toto   <--- ユーザtotoだけを許可する
 PermitEmptyPasswords            no     <--- 空のパスワードを許可しない

 RSAAuthentication               yes    <--- 公開鍵・秘密鍵を使ったクライアント認証を許可
 RhostsAuthentication            no
 RhostsRSAAuthentication         no
 HostbasedAuthentication         no
 ChallengeResponseAuthentication no
 PasswordAuthentication          no
上記は、変更した部分だけ。
恐らくこれで大丈夫だとは思いますが、詳しい方のアドバイスお待ちしています

2. sshdを一度動作させる

スクリプトファイルの中を見ればわかるが、スクリプト内でファイルがない場合はファイルの作成を行っている。
ファイルを作成するため、一度sshdを起動し停止する。

 [root@linux /root]# /etc/init.d/sshd start
 [root@linux /root]# /etc/init.d/sshd stop

3. xinetdからsshdを起動するように設定

/etc/xinetd.d/sshを作成する。

 service ssh
 {
         disable         = no
         socket_type     = stream
         protocol        = tcp
         wait            = no
         user            = root
         server          = /usr/sbin/sshd
         server_args     = -i                            <--- sshdをxinetdから起動するためのオプション
         only_from       = 172.25.0.0/24 .mopera.ne.jp   <--- LAN内とmopera.ne.jpからのアクセスのみ許可
 }

4. xinetdを再起動する


 [root@linux /root]# /etc/init.d/xinetd restart


<Prev Top Next>
Copyright(C) 2001-2003 Katsuyuki Kobayashi.
このサイトへのリンクや引用時はメール頂戴
webmaster@kkoba.com