Linux SSH隧道-通道2:打开失败:管理禁止-Ubuntu 18.4 VM
我需要从一个远程位置运行一个android项目到apperize.io模拟器。模拟器提供了一个ssh命令来执行此操作。每次我尝试连接时,它都会输出以下错误: 通过SSH连接的开胃命令Linux SSH隧道-通道2:打开失败:管理禁止-Ubuntu 18.4 VM,linux,amazon-ec2,ssh,Linux,Amazon Ec2,Ssh,我需要从一个远程位置运行一个android项目到apperize.io模拟器。模拟器提供了一个ssh命令来执行此操作。每次我尝试连接时,它都会输出以下错误: 通过SSH连接的开胃命令 sudo ssh -vv -fN -o StrictHostKeyChecking=no -p 2205 PUBLIC_KEY@useast-android-10.appetize.io -L6000:localhost:5609 && adb connect localhost:6000 错误
sudo ssh -vv -fN -o StrictHostKeyChecking=no -p 2205 PUBLIC_KEY@useast-android-10.appetize.io -L6000:localhost:5609 && adb connect localhost:6000
错误
通道2:打开失败:管理禁止:
通道2:空闲:直接tcpip:本地主机端口5609的侦听端口6000,从127.0.0.1端口49057连接到127.0.0.1端口6000,nchannels 3
CONNECTION OPEN FAILED
stderr: debug1: Connection to port 6000 forwarding to 127.0.0.1 port 5609 requested.
CONNECTION ALREADY FINISHED - STDERR
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
CONNECTION ALREADY FINISHED - STDERR
stderr: channel 2: open failed: administratively prohibited:
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 6000 for 127.0.0.1 port 5609, connect from 127.0.0.1 port 46698 to 127.0.0.1 port 6000, nchannels 3
CONNECTION ALREADY FINISHED - STDERR
stderr: debug1: Connection to port 6000 forwarding to 127.0.0.1 port 5609 requested.
CONNECTION ALREADY FINISHED - STDERR
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
CONNECTION ALREADY FINISHED - STDERR
stderr: channel 2: open failed: administratively prohibited:
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 6000 for 127.0.0.1 port 5609, connect from 127.0.0.1 port 46700 to 127.0.0.1 port 6000, nchannels 3
CONNECTION ALREADY FINISHED - STDERR
stderr: debug1: Connection to port 6000 forwarding to 127.0.0.1 port 5609 requested.
debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
CONNECTION ALREADY FINISHED - STDERR
stderr: channel 2: open failed: administratively prohibited:
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 6000 for 127.0.0.1 port 5609, connect from 127.0.0.1 port 46702 to 127.0.0.1 port 6000, nchannels 3
结果
该命令成功地建立了连接,验证了“将'[useast-android-9.appetize.io]:2208[209.222.0.20]:2208'(RSA)添加到已知主机列表中”,但当我尝试运行adb connect localhost:6000
时失败
该命令有时会起作用,因此我知道,在某些我仍然不知道的条件下,它会设法建立连接并连接到模拟器,但在大多数情况下它不起作用
我尝试了以下方法:
adb终止服务器和adb启动服务器
localhost
位于/etc/hosts文件中下面是运行命令的代码块: 很抱歉日志过多,此时我想输出任何内容以查找失败的原因
try{
var util = require('util'),
exec = require('child_process').exec;
let simulatorSSHURL = `ssh -vv -fN -o StrictHostKeyChecking=no -p ${simPort} ${simUser}@${simHost} -L6000:127.0.0.1:5609 && adb connect 127.0.0.1:6000`
console.log(`RUN SIMULATOR: ${simulatorSSHURL}` );
const buildAppOutput = exec(`adb kill-server && adb start-server && sudo ${simulatorSSHURL}`)
buildAppOutput.stdout.on('data', (data) => {
console.log('stdout: ' + data.toString())
if(!res.finished){
res.write(`data: ${JSON.stringify({data: data, end: false})}`);
res.write("\n\n");
}else{
console.log("CONNECTION ALREADY FINISHED - STDOUT");
}
});
buildAppOutput.stderr.on('data', (data) => {
console.log('stderr: ' + data.toString())
if(!res.finished){
if( data.toString().includes("open failed") ){
console.log("CONNECTION OPEN FAILED");
res.write(`data: ${JSON.stringify({data: data, end: true})}`);
res.write("\n\n");
res.end();
}else{
res.write(`data: ${JSON.stringify({data: data, end: false})}`);
res.write("\n\n");
}
}else{
console.log("CONNECTION ALREADY FINISHED - STDERR");
}
});
buildAppOutput.on('exit', (code) => {
console.log("Finished Compiling");
if(!res.finished){
res.write(`data: ${JSON.stringify({data: null, end: true})}`);
res.write("\n\n");
res.end();
}else{
console.log("CONNECTION ALREADY FINISHED - CATCH");
}
});
}catch(e){
console.log(`ERROR: ${e}`);
if( !res.finished){
res.write(`data: ${JSON.stringify({data: e, end: true})}`);
res.write("\n\n");
res.end();
}
}
这是输出日志:
我在日志的两行之间用黑色标记了成功的连接、身份验证和错误
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node index.js`
server running on port 5000
/api/v1/connect
{ port: '2208',
user: 'g1yjx7wq2pex4fvejxrt7d63rw',
hostname: 'useast-android-9.appetize.io' }
RUN SIMULATOR: ssh -vv -fN -o StrictHostKeyChecking=no -p 2208 g1yjx7wq2pex4fvejxrt7d63rw@useast-android-9.appetize.io -L6000:127.0.0.1:5609 && adb connect 127.0.0.1:6000
stderr: * daemon not running; starting now at tcp:5037
stderr: * daemon started successfully
stderr: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
stderr: debug2: resolving "useast-android-9.appetize.io" port 2208
stderr: debug2: ssh_connect_direct: needpriv 0
debug1:连接到useast-android-9.apperize.io[209.222.0.20]端口2208。
stderr: debug2: set_newkeys: mode 1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
stderr: debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 4294967296 blocks
debug2: key: /root/.ssh/id_rsa ((nil))
stderr: debug2: key: /root/.ssh/id_dsa ((nil))
debug2: key: /root/.ssh/id_ecdsa ((nil))
debug2: key: /root/.ssh/id_ed25519 ((nil))
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
stderr:debug1:已建立连接。
stderr: debug2: set_newkeys: mode 1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
stderr: debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 4294967296 blocks
debug2: key: /root/.ssh/id_rsa ((nil))
stderr: debug2: key: /root/.ssh/id_dsa ((nil))
debug2: key: /root/.ssh/id_ecdsa ((nil))
debug2: key: /root/.ssh/id_ed25519 ((nil))
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
debug1:永久\u设置\u uid:0/0
stderr: debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
stderr: debug1: Remote protocol version 2.0, remote software version appetize.io
debug1: no match: appetize.io
debug2: fd 3 setting O_NONBLOCK
debug1:验证使用AST-android-9。开胃。io:2208作为“g1yjx7wq2pex4fvejxrt7d63rw”
stderr: debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: host key algorithms: ssh-rsa
debug2: ciphers ctos: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,des-cbc-ssh1
debug2: ciphers stoc: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,des-cbc-ssh1
debug2: MACs ctos: hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib,zlib@openssh.com
debug2: compression stoc: none,zlib,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
stderr: debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
stderr: debug1: Server host key: ssh-rsa SHA256:bxqxb1Xs4R5c8DmAYmYtOHc1hcPgRMfak44LM3ORi5w
stderr:debug1:在没有端口标识符的情况下进行检查
警告:将“[useast-android-9.apperize.io]:2208[209.222.0.20]:2208'(RSA)永久添加到已知主机列表中。
stderr: debug2: set_newkeys: mode 1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
stderr: debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 4294967296 blocks
debug2: key: /root/.ssh/id_rsa ((nil))
stderr: debug2: key: /root/.ssh/id_dsa ((nil))
debug2: key: /root/.ssh/id_ecdsa ((nil))
debug2: key: /root/.ssh/id_ed25519 ((nil))
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
stderr:debug2:service\u accept:ssh userauth
debug1:SSH2\u消息\u服务\u接受已接收
stderr:debug1:身份验证成功(无)。
通过认证使用AST-android-9.appetize.io([209.222.0.20]:2208)。
stderr: debug2: set_newkeys: mode 1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
stderr: debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 4294967296 blocks
debug2: key: /root/.ssh/id_rsa ((nil))
stderr: debug2: key: /root/.ssh/id_dsa ((nil))
debug2: key: /root/.ssh/id_ecdsa ((nil))
debug2: key: /root/.ssh/id_ed25519 ((nil))
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
debug1:到本地主机的本地连接:6000转发到远程地址127.0.0.1:5609
stderr: debug1: Local forwarding listening on ::1 port 6000.
debug2: fd 4 setting O_NONBLOCK
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 6000.
debug2: fd 5 setting O_NONBLOCK
debug1: channel 1: new [port listener]
debug2: fd 3 setting TCP_NODELAY
debug1: forking to background
stderr: debug1: Entering interactive session.
stderr: debug1: pledge: network
stderr:debug1:请求连接到端口6000转发到127.0.0.1端口5609。
stderr: debug2: set_newkeys: mode 1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
stderr: debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 4294967296 blocks
debug2: key: /root/.ssh/id_rsa ((nil))
stderr: debug2: key: /root/.ssh/id_dsa ((nil))
debug2: key: /root/.ssh/id_ecdsa ((nil))
debug2: key: /root/.ssh/id_ed25519 ((nil))
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
stderr:通道2:打开失败:管理禁止:
调试2:通道2:僵尸
debug2:通道2:垃圾收集
debug1:通道2:空闲:直接tcpip:侦听端口6000用于127.0.0.1端口5609,从127.0.0.1端口46696连接到127.0.0.1端口6000,nchannels 3
CONNECTION OPEN FAILED
stderr: debug1: Connection to port 6000 forwarding to 127.0.0.1 port 5609 requested.
CONNECTION ALREADY FINISHED - STDERR
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
CONNECTION ALREADY FINISHED - STDERR
stderr: channel 2: open failed: administratively prohibited:
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 6000 for 127.0.0.1 port 5609, connect from 127.0.0.1 port 46698 to 127.0.0.1 port 6000, nchannels 3
CONNECTION ALREADY FINISHED - STDERR
stderr: debug1: Connection to port 6000 forwarding to 127.0.0.1 port 5609 requested.
CONNECTION ALREADY FINISHED - STDERR
stderr: debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
CONNECTION ALREADY FINISHED - STDERR
stderr: channel 2: open failed: administratively prohibited:
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 6000 for 127.0.0.1 port 5609, connect from 127.0.0.1 port 46700 to 127.0.0.1 port 6000, nchannels 3
CONNECTION ALREADY FINISHED - STDERR
stderr: debug1: Connection to port 6000 forwarding to 127.0.0.1 port 5609 requested.
debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
CONNECTION ALREADY FINISHED - STDERR
stderr: channel 2: open failed: administratively prohibited:
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 6000 for 127.0.0.1 port 5609, connect from 127.0.0.1 port 46702 to 127.0.0.1 port 6000, nchannels 3