2015-05-12 52 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]*

和它的工作!

謝謝