1

So, all in all I downloaded Termux for Android 7.1 which will act as the remote server.

C: client(192.168.1.4), R: remote server(192.168.1.3)

  • R: On termux I installed openssh.
  • C: ssh-keygen and sending the id_rsa.pub
  • R: received the file and put it into ~/.ssh/authorized_keys
  • R: sshd (to start the ssh server)
  • C: ssh 192.168.1.3 -p 8022

Output:

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

Now the output of 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: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com 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 no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com 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

And the output of sshd -d on the remote machine.

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: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com 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 no-more-sessions@openssh.com 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

I seem to not be able to comprehend what can be the cause, that's why I'm asking for advice, is there a way to make the connection work?

1

Rather sure it is this line: session_pty_req: session 0 alloc /dev/pts/1 chown(/dev/pts/1, 10176, 10176) failed: Permission denied

I'm having the same problem, will update if I find the fix

Only /dev/pts/0 exists on my device, would bet it is the same for you.

Think we have to create the device nodes

Edit: claimed the /dev/pty folder using mixplorer and rebooted, this resolved the error for me

Also ran termux-setup-storage within termux

  • Well, I happened to travel and thought I should give it another try, point is, now it works. Also, the storage setup was done in the same day as the ssh, probably it needed a restart. – Tigrex Apr 16 '17 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.