No.21719 投稿時間:2007年06月26日(Tue) 18:17 投稿者名:P介 URL:
自宅環境
回線:B Flets
プロバイダ:biglobe
サーバOS:FedoraCore5
クライアントOS:windowsXP Pro
TeraTerm:V4.49
クライアントからサーバへSSHで接続をしたいのですが、TeraTermでユーザ名、パスワード、鍵のパスを指定して接続を押しても入力画面に戻ってきてしまいます。
鍵は上記で入力するユーザで「ssh-keygen -t rsa」で作成。全てデフォルト値で作成しました。
パーミッションは共に600でユーザ、グループ共に同じです。(接続ユーザ)
authorized.keyも.pubをコピーして作成パーミッションは上記と同じです。
サーバ側のポートはSSH開放済みです。
以前同じ内容で作成したマシンがあり、そちらは正常に接続できます。OS等は同じCDを使用しています。
以下にsshd_configの内容を書きます。
# $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk 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
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# 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
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#RSAAuthentication yes
#PubkeyAuthentication yes
AuthorizedKeysFile /home/ssh/.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 no
# 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 mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=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
ダイブ調べたのですが、エラーも何も表示されない(サーバ、クライアント共に)のでお手あげ状態です。
何か確認すべき点、間違っている点などありますでしょうか?
ご指摘いただけると助かります。
よろしくお願いいたします。
No.21720 投稿時間:2007年06月26日(Tue) 19:55 投稿者名:tsuge URL:
TCP Wrappers経由で動いてるのなら、/etc/hosts.denyと/etc/hosts.allowの設定はお済みですか。
No.21722 投稿時間:2007年06月26日(Tue) 21:20 投稿者名:P介 URL:
/etc/hosts.denyと/etc/hosts.allowは特に記述していません。
このファイルはアクセスを制限するものと言う認識なので何も書かないのかなと思っておりましたが…。
TCP Wrappersが何か良く分かっていませんが、hostnameで出てきた名前を記述しておけば良いのでしょうか?
No.21724 投稿時間:2007年06月26日(Tue) 21:50 投稿者名:ひらぽん URL:
sshd_configを拝見するとssh2のみで設定しているようですが
TeraTermはssh2って使えなかったのでは??
最新のパッチがあれば対応しているかもわかりませんが、
少なくとも私の使っているTeraTermはssh1しか対応してません。
sshのクライアントツールでssh2対応をうたっているものを使ってみたらいかがでしょうか?
> 自宅環境
>
> 回線:B Flets
> プロバイダ:biglobe
> サーバOS:FedoraCore5
> クライアントOS:windowsXP Pro
> TeraTerm:V4.49
>
> クライアントからサーバへSSHで接続をしたいのですが、TeraTermでユーザ名、パスワード、鍵のパスを指定して接続を押しても入力画面に戻ってきてしまいます。
>
> 鍵は上記で入力するユーザで「ssh-keygen -t rsa」で作成。全てデフォルト値で作成しました。
> パーミッションは共に600でユーザ、グループ共に同じです。(接続ユーザ)
>
> authorized.keyも.pubをコピーして作成パーミッションは上記と同じです。
>
> サーバ側のポートはSSH開放済みです。
>
> 以前同じ内容で作成したマシンがあり、そちらは正常に接続できます。OS等は同じCDを使用しています。
>
> 以下にsshd_configの内容を書きます。
>
> # $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk 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
> #Protocol 2,1
> Protocol 2
> #AddressFamily any
> #ListenAddress 0.0.0.0
> #ListenAddress ::
>
> # 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
> PermitRootLogin no
> #StrictModes yes
> #MaxAuthTries 6
>
> #RSAAuthentication yes
> #PubkeyAuthentication yes
> AuthorizedKeysFile /home/ssh/.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 no
>
> # 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 mechanism.
> # Depending on your PAM configuration, this may bypass the setting of
> # PasswordAuthentication, PermitEmptyPasswords, and
> # "PermitRootLogin without-password". If you just want the PAM account and
> # session checks to run without PAM authentication, then enable this but set
> # ChallengeResponseAuthentication=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
>
>
> ダイブ調べたのですが、エラーも何も表示されない(サーバ、クライアント共に)のでお手あげ状態です。
> 何か確認すべき点、間違っている点などありますでしょうか?
>
> ご指摘いただけると助かります。
>
> よろしくお願いいたします。
No.21725 投稿時間:2007年06月26日(Tue) 22:01 投稿者名:tsuge URL:
FedoraCore5のsshdがTCP Wrappers経由で動いてるのなら下記ですが、
ご自分で調べることも必要かと思います。
------------------------------------------------------------
[/etc/hosts.deny]
ALL : ALL
[/etc/hosts.allow]
sshd:クライアントのローカルIPアドレス(192.168.0.xxxとか)
------------------------------------------------------------
それと、UTF-8 TeraTerm Pro with TTSSH2 v4.49ですよね。
No.21727 投稿時間:2007年06月26日(Tue) 23:27 投稿者名:P介 URL:
> FedoraCore5のsshdがTCP Wrappers経由で動いてるのなら下記ですが、
> ご自分で調べることも必要かと思います。
> ------------------------------------------------------------
> [/etc/hosts.deny]
>
> ALL : ALL
>
> [/etc/hosts.allow]
>
> sshd:クライアントのローカルIPアドレス(192.168.0.xxxとか)
> ------------------------------------------------------------
>
> それと、UTF-8 TeraTerm Pro with TTSSH2 v4.49ですよね。
調べているうちにますます分からなくなってしまいました。
とりあえず切り分けとしてTCP Wrappersを使用しているのかを調べようとしたのですが、/etc/inetd.conというファイルが存在しません。(find / -name *inetd.conf -print で検索)hosts.allowの設定をとりあえず行ってみましたが接続できませんでした。(再起動してもだめでした。)
テラタームは最初に書いたようにv4.49ですのでSSH2が使える認識です。
No.21729 投稿時間:2007年06月27日(Wed) 03:09 投稿者名:stranger URL:
> 自宅環境
>
> 回線:B Flets
> プロバイダ:biglobe
> サーバOS:FedoraCore5
> クライアントOS:windowsXP Pro
> TeraTerm:V4.49
>
> クライアントからサーバへSSHで接続をしたいのですが、TeraTermでユーザ名、パスワード、鍵のパスを指定して接続を押しても入力画面に戻ってきてしまいます。
>
> 鍵は上記で入力するユーザで「ssh-keygen -t rsa」で作成。全てデフォルト値で作成しました。
> パーミッションは共に600でユーザ、グループ共に同じです。(接続ユーザ)
>
> authorized.keyも.pubをコピーして作成パーミッションは上記と同じです。
>
> サーバ側のポートはSSH開放済みです。
>
> 以前同じ内容で作成したマシンがあり、そちらは正常に接続できます。OS等は同じCDを使用しています。
>
PasswordAuthenticationで試してみる
それで接続できるならば、公開鍵接続の問題?
authorized_keysに問題があるのでは?
別のマシンで公開鍵接続ができるのなら、その秘密鍵・公開鍵を使ってみる
(秘密鍵・公開鍵のペアは使いまわしができる)
No.21730 投稿時間:2007年06月27日(Wed) 11:07 投稿者名:P介 URL:
> PasswordAuthenticationで試してみる
> それで接続できるならば、公開鍵接続の問題?
> authorized_keysに問題があるのでは?
> 別のマシンで公開鍵接続ができるのなら、その秘密鍵・公開鍵を使ってみる
> (秘密鍵・公開鍵のペアは使いまわしができる)
パスワードでログインしたらすんなり入れました。
そこで現在接続できている別のサーバのauthorized key を問題のサーバへ入れ、念のためsshd再起動後ペアの鍵でログインを試してみましたが失敗。
さらに謎が深まってしまいました…。
No.21731 投稿時間:2007年06月27日(Wed) 11:44 投稿者名:P介 URL:
パスワードログインの許可 → アクセス成功(SSH)
他の正常に動いているSSHサーバの鍵ペアを使用 → 失敗
sshd_configの内容を正常に動作しているものに入れ替える → 失敗
変数の確認 → 同じ
iptables -L の結果 → 同じ
違いといえばハードの違いと回線の違いとWANかLANかの違いになります。
・正常に動いてるサーバ → LAN ADSL
・現在問題のサーバ → WAN B Flets
No.21733 投稿時間:2007年06月27日(Wed) 14:15 投稿者名:わらび URL:
>ダイブ調べたのですが、エラーも何も表示されない(サーバ、クライアント共に)のでお手あげ状態です。
#LogLevel INFO
を
LogLevel DEBUG
にすれば、ログでます。
>鍵は上記で入力するユーザで「ssh-keygen -t rsa」で作成。全てデフォルト値で作成しました。
>AuthorizedKeysFile /home/ssh/.ssh/authorized_keys
おそらくこれが、問題だと。
ssh-keygenを全てデフォルトだと、違う場所にできちゃいますよ。
やるなら、
AuthorizedKeysFile %h/.ssh/authorized_keys
とか
AuthorizedKeysFile .ssh/authorized_keys
などの、デフォルトがいいかと。
↑のキーの置き場所を変えたら、
同じコンフィグでRedhatEL4ですけどできました。
No.21737 投稿時間:2007年06月27日(Wed) 19:08 投稿者名:P介 URL:
> >鍵は上記で入力するユーザで「ssh-keygen -t rsa」で作成。全てデフォルト値で作成しました。
> >AuthorizedKeysFile /home/ssh/.ssh/authorized_keys
> おそらくこれが、問題だと。
> ssh-keygenを全てデフォルトだと、違う場所にできちゃいますよ。
>
> やるなら、
> AuthorizedKeysFile %h/.ssh/authorized_keys
> とか
> AuthorizedKeysFile .ssh/authorized_keys
> などの、デフォルトがいいかと。
上記の件でちょっと教えて下さい。
デフォルトだと
AuthorizedKeysFile .ssh/authorized_keys
と言う値が入っていたのですが、実際に鍵のある場所が
AuthorizedKeysFile /home/ssh/.ssh/authorized_keys
なので、あえてフルパスで記入してみたのが現在の設定です。(\.とかにしないとだめなのかな?)
設定上ではsshd_configのAuthorizedKeysFileの値と鍵の実際のパスが同じなら今から移動させても問題ないでしょうか?
No.21741 投稿時間:2007年06月27日(Wed) 22:41 投稿者名:stranger URL:
> > >鍵は上記で入力するユーザで「ssh-keygen -t rsa」で作成。全てデフォルト値で作成しました。
> > >AuthorizedKeysFile /home/ssh/.ssh/authorized_keys
> > おそらくこれが、問題だと。
> > ssh-keygenを全てデフォルトだと、違う場所にできちゃいますよ。
> >
> > やるなら、
> > AuthorizedKeysFile %h/.ssh/authorized_keys
> > とか
> > AuthorizedKeysFile .ssh/authorized_keys
> > などの、デフォルトがいいかと。
>
> 上記の件でちょっと教えて下さい。
>
> デフォルトだと
> AuthorizedKeysFile .ssh/authorized_keys
> と言う値が入っていたのですが、実際に鍵のある場所が
> AuthorizedKeysFile /home/ssh/.ssh/authorized_keys
> なので、あえてフルパスで記入してみたのが現在の設定です。(\.とかにしないとだめなのかな?)
>
> 設定上ではsshd_configのAuthorizedKeysFileの値と鍵の実際のパスが同じなら今から移動させても問題ないでしょうか?
理由
複数のユーザで接続する場合に都合が悪い
ユーザごとのディレクトリに .ssh/authorized_keysを作って接続します
No.21739 投稿時間:2007年06月27日(Wed) 21:28 投稿者名:P介 URL:
原因判明しました。すごく単純なミスです。
誤 authorized.key
正 authorized.keys
sshd_configで存在しないファイル名を指定しているのだから接続できなくて当たり前ですよね。
どうもお騒がせ致しました。