
Ubuntu日本語フォーラム

ログインしていません。
ubuntu にopenssh-server をインストールして、LAN内部にある別のマシンから接続できず、またサーバーで ssh localhost を実行しても接続できません。もしよろしければ力をお貸しください。
◯症状
サーバーで ssh localhost を実行
ssh localhost -p 20 Read from socket failed : Connection reset by peer
LAN内の別のマシン(Mac OS 10.7)からsshで接続を試みる
ssh [email protected] -p 20 Connection closed by 192.168.10.112
◯確認したこと
・sshd は動いているか
sudo service ssh status ssh start/running, process 3046
sshd は動いているようです。
・ポートは開いているか(ポート番号は20)
tcp 0 0 0.0.0.0:20 0.0.0.0:* LISTEN 3046/sshd tcp6 0 0 :::20 :::* LISTEN 3046/sshd
ポートも開いています
・/etc/hosts.allow には sshd : ALL と書いた
・パスワードログインも許可してあります
PasswordAuthentication yes
以上になります。よろしくおねがいします。
オフライン
追記になります。sshd をデバッグモードで起動させた結果です。
$ /usr/sbin/sshd -d debug1: sshd version OpenSSH_6.0p1 Debian-3ubuntu1 debug1: read PEM private key done: type RSA debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048 debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048 debug1: private host key: #0 type 1 RSA debug1: read PEM private key done: type DSA debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024 debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024 debug1: private host key: #1 type 2 DSA debug1: read PEM private key done: type ECDSA debug1: Checking blacklist file /usr/share/ssh/blacklist.ECDSA-256 debug1: Checking blacklist file /etc/ssh/blacklist.ECDSA-256 debug1: private host key: #2 type 3 ECDSA debug1: setgroups() failed: Operation not permitted debug1: rexec_argv[0]='/usr/sbin/sshd' debug1: rexec_argv[1]='-d' Set /proc/self/oom_score_adj from 0 to -1000 debug1: Bind to port 20 on 0.0.0.0. Bind to port 20 on 0.0.0.0 failed: Permission denied. debug1: Bind to port 20 on ::. Bind to port 20 on :: failed: Permission denied. Cannot bind any address.
オフライン
paragra 様へ。
これまで、SSH で接続したことはありますか?
特殊な設定をした SSH サーバでない限り、SSH のポートは 22 番で、
ポート指定(-p)を指定する必要がありません。
試しに、ポートを指定せずに接続してみてください。
localhost に接続する場合は
$ ssh localhost
LAN内の別のマシン(Mac OS 10.7)からsshで接続を試みる場合は
それでも解決できない場合、今回は特殊な設定をした SSH サーバへの接続だと考えられます。
もし、そうならば、そのサーバの設定も教えて戴けると助かります。
オフライン
hellfire様
返信ありがとうごうざいます。
ポートを標準の22に戻して試してもおなじ結果でした。
SSH サーバーは私がインストールしたものなので、特に変な設定はしていないと思うのですが‥
sshd_config の有効になっている設定部分をここに上げます。
よろしくおねがいします。
Port 22 ListenAddress 0.0.0.0 Protocol 2 # HostKeys for protocol version 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key #Privilege Separation is turned on for security UsePrivilegeSeparation yes # Lifetime and size of ephemeral version 1 server key KeyRegenerationInterval 3600 ServerKeyBits 768 # Logging SyslogFacility AUTH LogLevel INFO # Authentication: LoginGraceTime 120 PermitRootLogin yes StrictModes yes RSAAuthentication yes PubkeyAuthentication yes IgnoreRhosts yes RhostsRSAAuthentication no HostbasedAuthentication no PermitEmptyPasswords no ChallengeResponseAuthentication no PasswordAuthentication yes X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server UsePAM yes
オフライン
paragra 様へ。
再度、確認しますが、Ubuntu で openssh-server をインストールした後、
SSH に関しては何も設定していないのですね?
また、ファイアウォール等を設定していませんか?
これらの回答お願いします。
また、localhost で接続した際の症状に関して検索したところ、
以下の解決方法がヒットしました。
http://udenkon.blogspot.jp/2010/01/read-from-socket-failed-connection.html
openssh-server を再インストールすることで、解決するとあります。
これでもうまくいかない場合、念の為、ホームディレクトリ内にある .ssh ディレクトリを
バックアップした後、削除、あるいはリネームしてみてください。
オフライン
ListenAddress 0.0.0.0
記憶が定かではありませんが、標準ではコメントアウトされていたと思います。
アドレス 0.0.0.0 は間違いないのですか?
デバッグモードで起動した時のメッセージにも出ています。
debug1: Bind to port 20 on 0.0.0.0. Bind to port 20 on 0.0.0.0 failed: Permission denied. debug1: Bind to port 20 on ::. Bind to port 20 on :: failed: Permission denied. Cannot bind any address.
このオプションを設定したいならば、$ man sshd_config で確認するば説明と記述例があります。
他にプロトコルバージョンに"2"を指定していますが、プロトコルバージョン"1"に適用さ
れるRSAAuthenticationに"yes"を指定しているのも気になります。
Protocol 2
RSAAuthentication yes
こちらは接続できない件には影響していないと思いますが。
皆様丁寧なアドバイス本当にありがとうございます。
openssh-server を再インストールしたら何のこともなく接続できるようになりました。
具体的な原因はわかっていませんが、とりあえずこれで運用していこうとおもいます。
ありがとうございました。
オフライン