アプリ版:「スタンプのみでお礼する」機能のリリースについて

SSHから接続できず、ユーザー認証でエラーになってしまいます。
何かわかる方がいらっしゃいましたら、どうか少し教えて頂けないでしょうか。

OSはCentOS 6.2 です。

--------------------------------------------------------------------
■サーバー
--------------------------------------------------------------------
★設定
# vi /etc/ssh/sshd_conf
> Port 22
> Protocol 2
> AllowTcpForwarding yes
> GatewayPorts no
> MaxAuthTries 6
> MaxSessions 10
>
> ServerKeyBits 1024
> StrictModes yes
>
> SyslogFacility AUTHPRIV
> LogLevel DEBUG3
>
> PubkeyAuthentication yes
> PasswordAuthentication no
> PermitEmptyPasswords no
> AuthorizedKeysFile.ssh/authorized_keys
>
> PermitRootLogin without-password
> UsePrivilegeSeparation yes
>
> Subsystemsftp/usr/libexec/openssh/sftp-server
> X11Forwarding no

★鍵を作成
# su user1
$ ssh-keygen -t rsa -b 1024
$ Generating public/private rsa key pair.
$ Enter file in which to save the key (/user1/.ssh/id_rsa):
$ Enter passphrase (empty for no passphrase):
$ Enter same passphrase again:
$ Your identification has been saved in /user1/.ssh/id_rsa.
$ Your public key has been saved in /user1/.ssh/id_rsa.pub.
$ The key fingerprint is:
$ 50:4f:72:d4:0a:d6:d2:24:98:96:7b:xx:xx:xx:xx:xx user1@myhost.com
$ The key's randomart image is:

★鍵の名前を変更
$ cd /home/user1/.ssh/
$ cp id_rsa.pub authorised_keys
$ rm id_rsa.pub

★パーミッション確認
$ drwxr-xr-x.rootroot/etc/ssh
$ -rw-------rootroot/etc/ssh/sshd_conf
$ drwxr-xr-x.user1user1/home/user1
$ drwxr-xr-xuser1user1/home/user1/.ssh
$ -rw-r--r--user1user1/home/user1/.ssh/authorised_keys

★再起動
# service sshd restart
# Stopping sshd: OK ]
# Starting sshd: OK ]

--------------------------------------------------------------------
■クライアント
--------------------------------------------------------------------
Windows7 teraterm
ポート:22
SSHバージョン:SSH2
ユーザー名・パスフレーズを入力し、「RSA/DSA鍵を使う」に上記で作った「id_rsa」プライベート鍵をセット。
エラーメッセージ:「SSH2自動ログインエラー:ユーザー認証が失敗しました」

--------------------------------------------------------------------
■ ログ(/var/log/secure)抜粋
--------------------------------------------------------------------
Aug 6 17:57:26 localhost sshd[21819]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Aug 6 17:57:26 localhost sshd[21819]: debug1: trying public key file /user1/.ssh/authorized_keys
Aug 6 17:57:26 localhost sshd[21819]: debug1: restore_uid: 0/0
Aug 6 17:57:26 localhost sshd[21819]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Aug 6 17:57:26 localhost sshd[21819]: debug1: trying public key file /user1/.ssh/authorized_keys
Aug 6 17:57:26 localhost sshd[21819]: debug1: restore_uid: 0/0
Aug 6 17:57:26 localhost sshd[21819]: Failed publickey for user1 from yyy.yyy.yyy.yyy port 58193 ssh2
Aug 6 17:57:26 localhost sshd[21819]: debug3: mm_answer_keyallowed: key 0x7fc196d47cf0 is not allowed
Aug 6 17:57:26 localhost sshd[21819]: debug3: mm_request_send entering: type 22
Aug 6 17:57:26 localhost sshd[21819]: debug3: mm_request_receive entering
Aug 6 17:57:26 localhost sshd[21820]: debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa
Aug 6 17:57:26 localhost sshd[21820]: debug3: Wrote 68 bytes for a total of 2633
Aug 6 17:57:26 localhost sshd[21820]: Connection closed by yyy.yyy.yyy.yyy

※yyy.yyy.yyy.yyyは、teratermでアクセスしたIPです。

--------------------------------------------------------------------
■備考
--------------------------------------------------------------------
「nmap localhost」は「22/tcp open ssh」ですが、
グローバルIPで「nmap xxx.xxx.xxx.xxx」すると、22番がリストに出ませんでした。

ルーター、iptables、ともにポートは開けています。
(念のため、「iptables」と「system-config-firewall」は停止しています。)
ログを見ると、sshdまで到達しているように見えるのですが・・・。

A 回答 (1件)

コピペ時のミスでしょうか???



># vi /etc/ssh/sshd_conf

sshd_config
ですよね?

>> AuthorizedKeysFile.ssh/authorized_keys
>$ cp id_rsa.pub authorised_keys
>$ -rw-r--r--user1user1/home/user1/.ssh/authorised_keys
公開鍵ファイルの名前が異なっているようですが、間違いありませんか?
あと、公開鍵ファイルのパーミッションは600かと。
# cpで移すのではなく、cat id_rsa.pub >> authorized_keys で追記にするべき…かと思いますが。

>グローバルIPで「nmap xxx.xxx.xxx.xxx」すると、22番がリストに出ませんでした。

どこから実行したのか…が問題かと。
# まあ、ついでに言うなら22番ポートはやめておいた方がいいです。公開鍵認証とは言え。
    • good
    • 0
この回答へのお礼

ありがとうございます。
すみません、お礼の入力を忘れていました。
また、私の別の質問にも回答してくださいましたね。いつもお世話になっています。

>> AuthorizedKeysFile.ssh/authorized_keys
これでした。「authorised_keys」を作っていました。
お恥ずかしい限りで・・・。

お礼日時:2012/08/10 13:26

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!