Termux: conexión a <ip> cerrada por host remoto. Conexión a <ip> cerrada

1

Entonces, en general, descargué Termux para Android 7.1, que actuará como el servidor remoto.

C: cliente (192.168.1.4), R: servidor remoto (192.168.1.3)

  • R: En termux instalé openssh.
  • C: ssh-keygen y enviando id_rsa.pub
  • R: recibió el archivo y lo puso en ~ / .ssh / Authorizedkeys
  • R: sshd (para iniciar el servidor ssh)
  • C: ssh 192.168.1.3 -p 8022

Salida:

Connection to 192.168.1.3 closed by remote host.
Connection to 192.168.1.3 closed.

Ahora la salida de ssh -v 192.168.1.3 -p 8022

$ ssh -v 192.168.1.3 -p 8022 
OpenSSH_7.4p1, OpenSSL 1.0.2k  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 192.168.1.3 [192.168.1.3] port 8022.
debug1: Connection established.
debug1: identity file /home/rexu/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/rexu/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/rexu/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/rexu/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/rexu/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/rexu/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/rexu/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/rexu/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.5
debug1: match: OpenSSH_7.5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.3:8022 as 'rexu'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:uWF4EIP9EAIMrulgMfekFoj55DtmslRNrnPmgCAa6Yo
debug1: Host '[192.168.1.3]:8022' is known and matches the ECDSA host key.
debug1: Found key in /home/rexu/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/rexu/.ssh/id_rsa
debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
Enter passphrase for key '/home/rexu/.ssh/id_rsa': 
debug1: Authentication succeeded (publickey).
Authenticated to 192.168.1.3 ([192.168.1.3]:8022).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to 192.168.1.3 closed by remote host.
Connection to 192.168.1.3 closed.
Transferred: sent 3044, received 2876 bytes, in 0.1 seconds
Bytes per second: sent 53329.5, received 50386.2
debug1: Exit status -1

Y la salida de sshd -den la máquina remota.

debug1: sshd version OpenSSH_7.5, OpenSSL 1.0.2k  26 Jan 2017
debug1: private host key #0: ssh-rsa SHA256:Wevz7XcSTFCMpA/GO4WxlUAN9isYm+AsLtQ4q9rBLLU
debug1: private host key #1: ssh-dss SHA256:cQIyrWTVoADrEDfd4rba3IpzEWDInsmAVxgiuLEk54I
debug1: private host key #2: ecdsa-sha2-nistp256 SHA256:uWF4EIP9EAIMrulgMfekFoj55DtmslRNrnPmgCAa6Yo
debug1: private host key #3: ssh-ed25519 SHA256:p970c8OgOBNPb2Pb67PGvWK3eZx0pYy4Ku9XQWXypuQ
debug1: rexec_argv[0]='/data/data/com.termux/files/usr/bin/sshd'
debug1: rexec_argv[1]='-d'
debug1: Bind to port 8022 on ::.
Server listening on :: port 8022.
debug1: Bind to port 8022 on 0.0.0.0.
Server listening on 0.0.0.0 port 8022.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: inetd sockets after dupping: 4, 4
Connection from 192.168.1.4 port 38788 on 192.168.1.3 port 8022
debug1: Client protocol version 2.0; client software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Local version string SSH-2.0-OpenSSH_7.5
debug1: Enabling compatibility mode for protocol 2.0
debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_INIT
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: KEX done
debug1: userauth-request for user rexu service ssh-connection method none
debug1: attempt 0 failures 0
Failed none for rexu from 192.168.1.4 port 38788 ssh2
debug1: userauth-request for user rexu service ssh-connection method publickey
debug1: attempt 1 failures 0
debug1: userauth_pubkey: test whether pkalg/pkblob are acceptable for RSA SHA256:uNEH/NETAsWJ7Q53XCgdqa/II69EF1bir3H61hVY5Zw
debug1: temporarily_use_uid: 10176/10176 (e=10176/10176)
debug1: trying public key file /data/data/com.termux/files/home/.ssh/authorized_keys
debug1: fd 5 clearing O_NONBLOCK
debug1: matching key found: file /data/data/com.termux/files/home/.ssh/authorized_keys, line 1 RSA SHA256:uNEH/NETAsWJ7Q53XCgdqa/II69EF1bir3H61hVY5Zw
debug1: restore_uid: (unprivileged)
Postponed publickey for rexu from 192.168.1.4 port 38788 ssh2
debug1: userauth-request for user rexu service ssh-connection method publickey
debug1: attempt 2 failures 0
debug1: temporarily_use_uid: 10176/10176 (e=10176/10176)
debug1: trying public key file /data/data/com.termux/files/home/.ssh/authorized_keys
debug1: fd 5 clearing O_NONBLOCK
debug1: matching key found: file /data/data/com.termux/files/home/.ssh/authorized_keys, line 1 RSA SHA256:uNEH/NETAsWJ7Q53XCgdqa/II69EF1bir3H61hVY5Zw
debug1: restore_uid: (unprivileged)
Accepted publickey for rexu from 192.168.1.4 port 38788 ssh2: RSA SHA256:uNEH/NETAsWJ7Q53XCgdqa/II69EF1bir3H61hVY5Zw
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch
debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype [email protected] want_reply 0
debug1: server_input_channel_req: channel 0 request pty-req reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req pty-req
debug1: Allocating pty.
debug1: session_pty_req: session 0 alloc /dev/pts/1
chown(/dev/pts/1, 10176, 10176) failed: Permission denied
debug1: do_cleanup
debug1: session_pty_cleanup: session 0 release /dev/pts/1

Parece que no puedo comprender cuál puede ser la causa, por eso estoy pidiendo consejo, ¿hay alguna manera de hacer que la conexión funcione?

Tigrex
fuente

Respuestas:

1

Más bien seguro de que es esta línea: session_pty_req: sesión 0 alloc / dev / pts / 1 chown (/ dev / pts / 1, 10176, 10176) falló: Permiso denegado

Tengo el mismo problema, se actualizará si encuentro la solución

Solo / dev / pts / 0 existe en mi dispositivo, apostaría que es lo mismo para usted.

Creo que tenemos que crear los nodos del dispositivo

Editar: reclamó la carpeta / dev / pty usando mixplorer y reinicié, esto resolvió el error por mí

También ejecuté termux-setup-storage dentro de termux

Chriscarver
fuente
Bueno, por casualidad viajé y pensé que debería intentarlo de nuevo, el punto es que ahora funciona. Además, la configuración de almacenamiento se realizó el mismo día que el ssh, probablemente necesitó un reinicio.
Tigrex