首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ssh香蕉皮配mac

ssh香蕉皮配mac
EN

Stack Overflow用户
提问于 2015-05-12 11:02:54
回答 1查看 1.1K关注 0票数 0

所以我想用我的macbook控制我的香蕉圆周率使用SSH。这是我第一次使用ssh。因此,我学习了许多不同的教程,但它仍然不起作用。如果我跑:

代码语言:javascript
复制
pi@172.25.54.12

代码语言:javascript
复制
bananapi@172.25.54.12

或者不管我用什么名字,它都能回答我

连接到主机172.25.*.*2端口22:操作超时

当我试着

代码语言:javascript
复制
bananapi@localhost

代码语言:javascript
复制
pi@localhost

它回答我:

ssh:连接到主机本地主机端口22:连接被拒绝

我发现我的IP地址在我的bananapi上做ifconfig。我的bananapi使用ban宛语(debian表示香蕉pi),我的mac是10.10.3。

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

代码语言:javascript
复制
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

有什么想法吗?

编辑:因此,正如评论中所建议的,我做了一个:

代码语言:javascript
复制
$ 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文件中有一个密钥。我要把它(公钥)寄给我的香蕉皮吗?

edit#2:这里是我的入口,没有隐藏的172.25.54.12,我现在想要的只是把我的mac连接到我的香蕉pi,并控制它作为一个服务器。所以我的Mac将成为客户,我的香蕉皮将成为我的“主机”。当我跑的时候

代码语言:javascript
复制
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),但是它不起作用。

edit#3:我试过用PC和puTTY,但是我遇到了一个错误:网络错误:网络是无法到达的。

也许能帮上忙。

Edit#4

好的,我理解了我的问题的一部分:我认为可以直接连接我的两个设备而不使用本地网络。我的意思是用一根以太网电缆直接把我的香蕉皮和我的mac连接起来。但我的目标是能够连接到我的香蕉π,即使它没有连接到任何网络(这可能吗?),所以我想使用一个静态IP地址,这是一个好主意吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-13 14:45:48

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

代码语言:javascript
复制
gedit /etc/network/interfaces

然后我用这种方式修改了文件

代码语言:javascript
复制
#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.*

因此,对于地址,我放置了一个非常类似于我的Mac地址的IP地址(为了让mac地址运行ipconfig getifaddr en0),对于网关,我放置了我的mac地址。

然后我用交叉以太网电缆连接了我的两个设备。在我的mac终端上,我跑了:

bananapi@169.x.y*

而且起作用了!

谢谢

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30188924

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档