简体   繁体   English

SSh:Connection拒绝localhost

[英]SSh: Connection refused to localhost

I want to install hadoop to ubuntu. 我想将hadoop安装到ubuntu。

I'm following this tutorial: Running Hadoop on Ubuntu Linux 我正在学习本教程: 在Ubuntu Linux上运行Hadoop

But i am facing a problem at step ssh localhost 但我在步骤ssh localhost遇到问题

hduser@r:~$ ssh -vvv localhost -p 8047
OpenSSH_6.2p2 Ubuntu-6ubuntu0.1, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 8047.
debug1: connect to address 127.0.0.1 port 8047: Connection refused
ssh: connect to host localhost port 8047: Connection refused

hduser@r:~$ which ssh
/usr/bin/ssh
hduser@r:~$ which sshd
hduser@r:~$ 

This is my /etc/ssh/sshd_config: 这是我的/ etc / ssh / sshd_config:

last 5 lines added only! 最后5行只添加!

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#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
#AuthorizedKeysFile %h/.ssh/authorized_keys

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

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

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

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# 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 yes

AllowGroups hduser


# disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

thanks in advance (and also for not voting down :D ) ) 提前谢谢(还有没有投票:D))

EDIT: 编辑:

hduser@r:~$ r@r:~$ netstat -tulpn

tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:17500           0.0.0.0:*               LISTEN      -               
udp        0      0 127.0.1.1:53            0.0.0.0:*                           -               
udp        0      0 0.0.0.0:68              0.0.0.0:*                           -               
udp        0      0 0.0.0.0:631             0.0.0.0:*                           -               
udp        0      0 0.0.0.0:17500           0.0.0.0:*                           -               
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -               
udp        0      0 0.0.0.0:26575           0.0.0.0:*                           -               
udp        0      0 0.0.0.0:47235           0.0.0.0:*                           -               
-         

你需要安装openssh服务器

sudo apt-get install openssh-server

Don't panic! 别恐慌! Your command is incorrect. 你的命令不正确。

ssh -vvv localhost -p 8047

The parameter -p 8047 means to reach port 8047, however SSH daemon runs at port 22. The config of sshd you pasted, has already proven my assumption. 参数-p 8047表示到达端口8047,但SSH守护进程在端口22运行。您粘贴的sshd配置已经证明了我的假设。

You can try to access localhost via SSH by using 您可以尝试使用SSH通过SSH访问localhost

ssh hduser@localhost

Run netstat -tulpn to see what services are running and on which ports. 运行netstat -tulpn以查看正在运行的服务以及哪些端口。 Note that you may have to change the options, but Ubuntu and Fedora work fine with '-tulpn' options. 请注意,您可能需要更改选项,但Ubuntu和Fedora可以正常使用'-tulpn'选项。

you can use of PuTTY SSH Client tool in ubuntu, like bellow example : 您可以在ubuntu中使用PuTTY SSH Client工具,如下图所示:

1 - set your IP and Port number and Connection type as SSH 1 - 将您的IPPort number以及Connection typeSSH

在此输入图像描述

2 - Enter your username and password 2 - 输入您的usernamepassword

在此输入图像描述

3 - now you are Logined into the Router Configuration with Secure Shell state. 3 - 现在您已Logined到具有Secure Shell状态的路由器配置。 this solution is very safe and anybody cannot sniff the authentication . 这个解决方案非常安全,任何人都无法sniff authentication

在此输入图像描述

Actually i solved this, I just installed shh daemon. 其实我解决了这个,我刚安装了shh守护进程。

in terminal : 在终端:

sudo apt-get install openssh-server

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM