2015-05-12 59 views
0

所以我想用我的macbook pro控制我的香蕉pi使用SSH。这是我第一次使用ssh。所以我跟着很多不同的教程,它仍然无法正常工作。 如果我运行:ssh香蕉pi与mac

[email protected] 

[email protected] 

或什么名字,我尝试回答我,

ssh: connect to host 172.25.*.*2 port 22: Operation timed out

,当我尝试

[email protected] 

[email protected] 

它回答我:

ssh: connect to host localhost port 22: Connection refused

我发现我的IP地址做的ifconfig我bananapi。 我的bananapi使用bananian(debian for banana pi),我的mac是10.10.3。

当我运行的sshd -T,我有:

port 22 
protocol 2 
addressfamily any 
listenaddress 0.0.0.0:22 
listenaddress [::]:22 
usepam 1 
serverkeybits 768 
logingracetime 120 
keyregenerationinterval 3600 
x11displayoffset 10 
maxauthtries 6 
maxsessions 10 
clientaliveinterval 0 
clientalivecountmax 3 
permitrootlogin yes 
ignorerhosts yes 
ignoreuserknownhosts no 
rhostsrsaauthentication no 
hostbasedauthentication no 
hostbasedusesnamefrompacketonly no 
rsaauthentication yes 
pubkeyauthentication yes 
kerberosauthentication no 
kerberosorlocalpasswd yes 
kerberosticketcleanup yes 
gssapiauthentication no 
gssapikeyexchange no 
gssapicleanupcredentials yes 
gssapistrictacceptorcheck yes 
gssapistorecredentialsonrekey no 
passwordauthentication yes 
kbdinteractiveauthentication no 
challengeresponseauthentication no 
printmotd no 
printlastlog yes 
x11forwarding yes 
x11uselocalhost yes 
strictmodes yes 
tcpkeepalive yes 
permitblacklistedkeys no 
permitemptypasswords no 
permituserenvironment no 
uselogin no 
compression delayed 
gatewayports no 
usedns no 
allowtcpforwarding yes 
useprivilegeseparation yes 
pidfile /var/run/sshd.pid 
xauthlocation /usr/bin/xauth 
ciphers aes256-ctr,aes128-ctr 
macs hmac-sha2-512,hmac-sha2-256,hmac-ripemd160 
loglevel INFO 
syslogfacility AUTH 
authorizedkeysfile .ssh/authorized_keys .ssh/authorized_keys2 
hostkey /etc/ssh/ssh_host_rsa_key 
acceptenv LANG 
acceptenv LC_* 
subsystem sftp /usr/lib/openssh/sftp-server 
maxstartups 10:30:100 
permittunnel no 
ipqos lowdelay throughput 
permitopen any 

任何想法?

编辑: 以便在意见建议,我做了:

$ ls -al ~/.ssh 
total 24 drwx------ 5 ***************** staff 170 12 mai 13:27 . 
drwxr-xr-x 53 **************** staff 1802 12 mai 11:16 .. 
-rw------- 1 ***************** staff 1766 12 mai 11:16 authorized_keys 
-rw------- 1 ***************** staff 1679 12 mai 13:27 id_rsa 
-rw-r--r-- 1 ***************** staff 429 12 mai 13:27 id_rsa.pub – 

这是我得到的答案。所以我在authorized_keys文件中有一个密钥。 我必须将它(公钥)发送到我的香蕉pi吗?

编辑#2: 这里是我的地址更少隐藏172.25.54.12我现在想要的只是连接我的苹果到我的香蕉pi和控制它作为一个服务器。所以我的Mac将成为客户,而我的香蕉pi是我的“主人”。 当我运行

netstat -an | grep 22 

tcp  0  0 0.0.0.0:22    0.0.0.0:*    LISTEN  
tcp6  0  0 :::22     :::*   LISTEN  
udp  0  0 0.0.0.0:32622   0.0.0.0:*  
unix 3  [ ]   STREAM  CONNECTED  4122  
unix 3 [ ]   STREAM  CONNECTED  2922  @/tmp/.X11-unix/X0 

基本上我所做的是,我也跟着互联网(像这样的https://www.youtube.com/watch?v=0wn44MbxtZw)上的一些教程,但它不工作。

编辑#3: 我试着用电脑和puTTY,我有一个错误: 网络错误:网络无法访问。

也许它可以帮助。

编辑#4

好吧,我明白我的问题的一部分:我认为这是可能直接我的两个设备,而无需通过本地网络连接。我的意思是用一根以太网线将我的香蕉pi直接连接到我的mac。但我的目标是能够连接到我的香蕉pi,即使它没有连接到任何网络(是否可能?),所以我想使用静态IP地址,这是一个好主意吗?

+0

确保您的Mac的SSH密钥是'authorizedkeysfile的.ssh/authorized_keys中的.ssh/authorized_keys2' –

+0

NOP我的本地IP地址就像是172.25.x.x –

+0

我怎么就可以验证这一点? –

回答

0

好吧,所以我找到了一种方法去做我想做的事情。这意味着只需使用以太网电缆(交叉以太网电缆)将我的Mac与我的香蕉pi直接连接即可。 我编辑的网络接口做:

gedit /etc/network/interfaces 

,然后我修改了文件,这样

#interfaces (5) file used by ifup(8° and ifdown(8) 
auto lo 
iface lo inet loopback 

#dhcp configuration 
allow-hotplug eth0 
#iface eth0 inet dhcp 
#static ip configuration 
auto eth0 
iface eth0 inet static 
adress 169.x.y.z 
netmask 255.255.255.0 
gateway 169.X.Y.* 

因此,对于地址,我把一个IP真的类似我的Mac IP地址(获取MAC IP地址运行ipconfig getifaddr en0) 而对于网关,我把我的MAC IP地址。

然后我用交叉以太网电缆连接我的两台设备。而在我的Mac终端,我跑:

[email protected]*

和它的工作!

谢谢