proot-distro icon indicating copy to clipboard operation
proot-distro copied to clipboard

[Feature]: How to directly ssh into ubuntu I installed by proot-distro?

Open chenjinlei opened this issue 2 years ago • 3 comments

Feature description

Hi, there!

I wanted to directly login into ubuntu I installed by proot-distro, is there any way? Thanks ahead.

chenjinlei avatar Jun 02 '22 06:06 chenjinlei

Run this command in Termux once when open :

echo "proot-distro login ubuntu" >> /data/data/com.termux/files/usr/etc/profile

Restart the termux (close & open app)

ShivaShirsath avatar Jun 02 '22 09:06 ShivaShirsath

Proxytunnel now works for me (see issue #193) but that's kind of irrelevant. The OP's question can be answered like this:

You can log directly into the prooted operating system by installing openssh-server (in the case of Ubuntu) and configuring it to listen at some set of ports other than 8022, which is where the Android ssh will be listening. To talk to the Android OS, 'ssh -p 8022 <android IP>'; to talk to Ubuntu, use whatever (different) port(s) you configured sshd to listen on.

Steve-Newcomb avatar Jun 03 '22 17:06 Steve-Newcomb

Validated direct SSH logins into TermuxArch using JuiceSSH can bypass the intermediate step of first accessing Termux. Setup notes:

  • Dont forget to set ssh user passwd
  • Use pkill sshd to stop server
  • Use /usr/bin/sshd to start server
  • Start server as root user while debugging
  • Enable both IPv4 and IPv6
  • Test SSH access inside proot env first
  • Then test with JuiceSSH or other client
  • Use ip a to see inet address
  • Use ssh-keygen -A to gen host keys
  • Use sshd -t to test configs (no output = success)

Screenshot_20220606_002914

vhscom avatar Jun 05 '22 16:06 vhscom

  1. Run ssh-keygen -A
  2. Edit /etc/ssh/sshd_config: add/change the value of entry Port to 10022 or any other high port. Note: Termux SSH uses 8022, I'd recommend to use something else for proot.
  3. Setup authentication for your user: passwd or add SSH public key to ~/.ssh/authorized_keys. Note that password login may be disabled for root user by default. If you need it then editing /etc/ssh/sshd_config may be required.
  4. Launch SSH daemon: /usr/sbin/sshd. From this point don't exit session where sshd was launched! Otherwise server will be terminated like any other proot-distro (proot) child process.

sylirre avatar Mar 20 '23 14:03 sylirre

Hey, I have installed archlinux with proot-distro and I'm trying to open an x11 window through ssh, for which I need to remotely connect to the archlinux ssh, not the termux ssh. I have everything setted up as said in this thread but ssh refuses to let me in. The moment I connect, it says Connection to 192.168.0.15 closed by remote host. I can though connect to the termux ssh (yes, they have different ports). Any ideas on what could be happening?

feer9 avatar Jun 03 '23 00:06 feer9

Update: running the server in verbose mode threw me this:

chown(/dev/pts/2, 10331, 5) failed: Permission denied debug1: do_cleanup debug1: session_pty_cleanup2: session 0 release /dev/pts/2 Attempt to write login records by non-root user (aborting)

It turns out I was running the ssh server as a normal user. Running it with sudo solved the issue. It's really funny that an error that makes the program crash is not printed to stderr on normal execution.

feer9 avatar Jun 03 '23 03:06 feer9