D4rCM4rC / MagiskSSH

17 stars 2 forks source link

key exchange auth the other way around #3

Open eisengrau opened 3 years ago

eisengrau commented 3 years ago

Hello,

I have just installed the SSH module, and added my host's public key, so I was able to connect to my android device.

My question is now related to the 'other way around'. I would like to connect to a remote ssh server from the android device, using key exchange auth. I have generated a key pair on android (using ssh-keygen), this created a key pair into the default offered directory //.ssh/. I copied the resulting public key to my remote ssh host, and was able to connect.

However, the //.ssh/ directory on the phone is not persistent, after a reboot the dir and the keys are gone, so I won't be able to reconnect to the same remote host from the phone again. Also ssh-keygen can only write to these directory when i remount the / filesystem to rw... which is ok, but the main issue is this below:

I tired to place/genereate new keypairs into different (common sense) directores, and place the private key elsewhere into a persistent directory, but it seems that the sshd daemon on android ignores them. Tried to move id_rsa (private key) to /data/ssh, /data/ssh/root/.ssh, /root/.ssh to n avail. Also checked /data/ssh/sshd_config (by the way there is also /etc/ssh/sshd_config - this could be the issue), but it seems that the root dir of the service should be under /data/ssh and the keypair store dir for the two users root and sheel, should be under /data/ssh/root/.ssh ?