2014-03-07 110 views
2

我想安装hadoop到Ubuntu。SSh:连接拒绝到本地主机

我下面这个教程:Running Hadoop on Ubuntu Linux

但我在步骤ssh localhost

[email protected]:~$ 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 

[email protected]:~$ which ssh 
/usr/bin/ssh 
[email protected]:~$ which sshd 
[email protected]:~$ 

面临的一个问题,这是我的/ etc/SSH/sshd_config中:

最后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 

在此先感谢(也为没有否决:d))

编辑:

[email protected]:~$ [email protected]:~$ 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:*       -    
-   
+1

什么mbratch说!如果不是,那么运行'sudo service sshd start' – problemPotato

+0

出现错误,sshd:无法识别的服务从'sudo service sshd start' – ridvanzoro

+1

你有什么理由相信*任何*会在端口8047上监听?特别是如果你没有配置它呢? – tripleee

回答

2

不要惊慌!你的命令不正确。

ssh -vvv localhost -p 8047 

参数-p 8047意味能接触到端口8047,但是SSH服务在22端口要粘贴的sshd的配置上运行,已经证明了我的假设。

你可以尝试通过SSH使用

ssh [email protected] 
+0

我知道'-p 8047'是错的。但是'ssh hduser @ localhost'帮我找到了问题。它提供了'在/home/hduser/.ssh/known_hosts:1中删除ECDSA密钥:ssh-keygen -f“/home/hduser/.ssh/known_hosts” -R本地主机“。然后它工作在'ssh-keygen -f“/home/hduser/.ssh/known_hosts”-R localhost '命令之后。 – ridvanzoro

0

运行netstat -tulpn,看看有什么服务正在运行和在哪个端口上。请注意,您可能需要更改选项,但Ubuntu和Fedora可以使用'-tulpn'选项正常工作。

+0

我更新我的问题,并添加netstat -tulpn的结果 – ridvanzoro

+1

netstat的输出显示哪些服务正在哪些端口上侦听。您发布的输出显示在端口8047上没有任何监听,因此您收到Connection refused错误是有道理的。如果你真的想通过这个端口连接,你需要让你的sshd监听它。 – SS781

19

您需要安装OpenSSH服务器

sudo apt-get install openssh-server 
0

你可以在Ubuntu使用的PuTTY SSH Client工具,像波纹管例如访问本地主机:

1 - 将您的IPPort numberConnection type设为SSH

enter image description here

2 - 输入您usernamepassword

enter image description here

3 - 现在你是LoginedSecure Shell状态的路由器配置。 此解决方案非常安全,任何人都不能sniffauthentication

enter image description here

0

其实我解决了这个,我刚刚安装嘘守护进程。

在终端:

sudo apt-get install openssh-server 
相关问题