Server ≫ Linux Server ≫ Fedora 8 ≫ SSHサーバー

 
   
サーバー側の設定
   
  SSH はクライアント機よりリモートでサーバー機を操作できるソフトです。

従来のTelnetは平分で通信を行うのに対してSSHは暗号化して通信を行うためより安全な通信手段です。

また、Fedora 8 には標準で搭載されていますので設定をすれば利用できるようになります。

尚、設定をしなくても利用可能ですがセキュリティの事を考えると多少の設定が必要かと・・・・・

下記のように入力します。下記のように緑色の部分を黄色に変更(書き換え・削除)して下さい。赤文字は説明です。 青文字が入力文字です。

   
 
 [root@linux]#
vi /etc/ssh/sshd_config  ← 入力
 #       $OpenBSD: sshd_config,v 1.75 2007/03/19 01:01:29 djm Exp $
 # This is the sshd server system-wide configuration file. See
 # sshd_config(5) for more information.
 # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

 # The strategy used for options in the default sshd_config shipped with
 # OpenSSH is to specify options with their default value where
 # possible, but leave them commented. Uncommented options change a
 # default value.

 
#Port 22
       ↓ セキュリティ対策のためポートを **** に変更
 
Port ****    (ネットワーク外部から接続しないのであれば変更の必要は無し)
 #AddressFamily any
 #ListenAddress 0.0.0.0
 #ListenAddress ::

 # Disable legacy (protocol version 1) support in the server for new
 # installations, in future the default will change to require explicit
 # activation of protocol 1
 Protocol 2

 # HostKey for protocol version 1
 #HostKey /etc/ssh/ssh_host_key
 # HostKeys for protocol version 2
 #HostKey /etc/ssh/ssh_host_rsa_key
 #HostKey /etc/ssh/ssh_host_dsa_key

 # Lifetime and size of ephemeral version 1 server key
 #KeyRegenerationInterval 1h
 #ServerKeyBits 768

 # Logging
 # obsoletes QuietMode and FascistLogging
 #SyslogFacility AUTH
 SyslogFacility AUTHPRIV
 #LogLevel INFO

 # Authentication:

 #LoginGraceTime 2m
 
#PermitRootLogin yes
       ↓ セキュリティ対策のため root のログインを許可しない
 
PermitRootLogin no
 #StrictModes yes
 #MaxAuthTries 6

 #RSAAuthentication yes
 #PubkeyAuthentication yes
 #AuthorizedKeysFile .ssh/authorized_keys

 # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
 #RhostsRSAAuthentication no
 # similar for protocol version 2
 #HostbasedAuthentication no
 # Change to yes if you don't trust ~/.ssh/known_hosts for
 # RhostsRSAAuthentication and HostbasedAuthentication
 #IgnoreUserKnownHosts no
 # Don't read the user's ~/.rhosts and ~/.shosts files
 #IgnoreRhosts yes

 # To disable tunneled clear text passwords, change to no here!
 #PasswordAuthentication yes
 #PermitEmptyPasswords no
 PasswordAuthentication yes

 # Change to no to disable s/key passwords
 #ChallengeResponseAuthentication yes
 ChallengeResponseAuthentication no

 # Kerberos options
 #KerberosAuthentication no
 #KerberosOrLocalPasswd yes
 #KerberosTicketCleanup yes
 #KerberosGetAFSToken no

 # GSSAPI options
 #GSSAPIAuthentication no
 GSSAPIAuthentication yes
 #GSSAPICleanupCredentials yes
 GSSAPICleanupCredentials yes

 # Set this to 'yes' to enable PAM authentication, account processing,
 # and session processing. If this is enabled, PAM authentication will
 # be allowed through the ChallengeResponseAuthentication and
 # PasswordAuthentication. Depending on your PAM configuration,
 # PAM authentication via ChallengeResponseAuthentication may bypass
 # the setting of "PermitRootLogin without-password".
 # If you just want the PAM account and session checks to run without
 # PAM authentication, then enable this but set PasswordAuthentication
 # and ChallengeResponseAuthentication to 'no'.
 #UsePAM no
 UsePAM yes

 # Accept locale-related environment variables
 AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
 AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 AcceptEnv LC_IDENTIFICATION LC_ALL
 #AllowTcpForwarding yes
 #GatewayPorts no
 #X11Forwarding no
 X11Forwarding yes
 #X11DisplayOffset 10
 #X11UseLocalhost yes
 #PrintMotd yes
 #PrintLastLog yes
 #TCPKeepAlive yes
 #UseLogin no
 #UsePrivilegeSeparation yes
 #PermitUserEnvironment no
 #Compression delayed
 #ClientAliveInterval 0
 #ClientAliveCountMax 3
 #ShowPatchLevel no
 #UseDNS yes
 #PidFile /var/run/sshd.pid
 #MaxStartups 10
 #PermitTunnel no

 # no default banner path
 #Banner /some/path

 # override default of no subsystems
 Subsystem sftp /usr/libexec/openssh/sftp-server

 # Example of overriding settings on a per-user basis
 #Match User anoncvs
 #       X11Forwarding no
 #       AllowTcpForwarding no
 #       ForceCommand cvs server
 
   
  以上の設定をしたら保存して終了です。

設定が終了したら SSH を起動します。下記のように入力します。 青文字が入力文字です。

   
   
 
[root@linux]# /etc/rc.d/init.d/sshd start  ← 入力

 SSH1 RSA ホストキーを生成中                   [
OK ]
 
SSH2 RSA ホストキーを生成中                   [ OK ]
 
SSH2 DSA ホストキーを生成中                   [ OK ]
 sshd を起動中                                 [
OK ]
 
   
  続いてPCの再起動に sshd を自動的に起動するようにします。下記のように入力します。青文字が入力文字です。
   
   
 [root@linux]#
chkconfig sshd on      ← 入力
 
   
  自動起動設定の確認。下記のように入力し 、下記のように表示されればOKです。青文字が入力文字です。
   
   
 [root@linux]#
chkconfig --list sshd      ← 入力
 sshd          0:off   1:off   2:on   3:on   4:on   5:on   6:off
 
   
  再起動は下記のように入力します。青文字が入力文字です。
   
   
 [root@linux]#
/etc/rc.d/init.d/sshd restart      ← 入力
 
   
  次にSSHサーバー用のポート **** を開放します。(**** は設定したポート番号)

設定ファイル iptables が開き最終行に -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport **** -j ACCEPT を追記してポート番号 **** を開きます。青文字が入力文字です。

ただし、ネットワーク外部から接続しないためポート番号を変更していない場合は **** の部分は 22 になります。

   
   
 
[root@linux]# vi /etc/sysconfig/iptables    ← vi /etc/sysconfig/iptables を入力(iptables を開く)
 # Firewall configuration written by system-config-securitylevel
 # Manual customization of this file is recommended.
 *filter
 : IMPUT ACCEPT [0:0]
        ↓↓
    ↓↓ 途中省略
    ↓↓

 -A INPUT -j RH-Firewall-1-INPUT
        ↓↓
    ↓↓ 途中省略
    ↓↓

 
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport **** -j ACCEPT    ← 最終行に追記
 
   
  設定を反映させるため iptables を再起動させます。
   
 
 [root@papa-net ~]#
/etc/rc.d/init.d/iptables restart     ← 入
 ファイアウォールルールを適用中:                [
OK ]
 チェインポリシーを ACCEPT に設定中filter       [
OK ]
 iptables モジュールを取り外し中                [
OK ]
 iptables ファイアウォールルールを適用中:       [
OK ]

 
   
  これでサーバー側の設定は完了です。
   
   
クライアント側(Windows)のソフトのインストールと設定
   

クライアント側ソフトは Poderosa を使います。まず、ソフトのダウンロードですが http://ja.poderosa.org にアクセスします。

メニューのダウンロードの中にある“インストールパッケージ”をクリックします。

下図のような画面が表示されます。

画面をスクロールし画面下にあるダウンロードをクリックします。

下図のような画面が出た場合は『保存』をクリックしてダウンロードを続け適当な場所に保存します。

ダウンロードが完了すると下図のようなセットアップファイルが表示されますのでダブルクリックしてインストールを開始します。

下図のような画面が出た場合は『実行(R)』をクリックしてインストールを続けます。

『次へ(N)』をクリックします。

ライセンス契約が表示されますので『同意する(A)』の前のチェックボックスにチェックを入れ『 次へ(N)』をクリックします。

インストール場所の設定ですが、場所を指定する場合は『参照(R)』をクリックして適当な場所を指定し『次へ(N)』をクリックします。

『Next>』をクリックします。

自分の希望によりチェックボックスにチェックを入れ『Next>』をクリックします。

『インストール(I)』をクリックします。インストールが開始されます。

『終了(F)』をクリックします。

上記で『Poderosa を起動』の前のチェックボックスにチェックを入れ『終了(F)』をクリックし た場合と初回起動時に下図のようなダイアログボックスが表示されます。『OK)』をクリックします。

『ホスト(H)』 にサーバーのIPアドレス、『ユーザ名(A)』にサーバーのユーザー名、『パスフレーズ(P)』にパスワードを入力し、その他は下図のような設定をして『OK』をクリックします。

『OK』をクリックします。

下図のようにサーバーに接続されます。

また、通常起動は下図のようなアイコン(ショートカット)をダブルクリックするかスタートメニューより poderosa をクリックして起動させます。

起動したら下図のように『ファイル(F)』メニューの『新規Telnet/SSH接続(E)』をクリックします。

下図のようなダイアログボックスが表示されますので『パスフレーズ(P)』にパスワードを入力して『OK)』をクリックします。これでサーバーに接続されます。

   
   

戻る