Magisk-Modules-Repo / ssh

ssh
181 stars 34 forks source link

Can't log in as root directly #14

Open lemmy04 opened 5 years ago

lemmy04 commented 5 years ago

Module is installed, keys are in place, when I try to connect I get:

lemmy@akari:~/Work/susebuildservice/home:lemmy04/Telegram> ssh root@s8 /system/bin/sh: Permission denied Connection to s8 closed.

ssh-ing in as the shell user works tho.

lemmy04 commented 5 years ago

maybe related:

lemmy@akari:~/Work/susebuildservice/home:lemmy04/Telegram> ssh shell@s8 dream2lte:/data/ssh/shell $ su - sh: su: not found

lemmy04 commented 5 years ago

same problem on a Samsung Tab S2 running Android 7 - can login as shell user, can't login as root, can't use su command.

DevSec-Nate commented 5 years ago

@lemmy04 -- I had the same issue. Restarting the SSH service seemed to have fixed it for me, I'm not sure why. Also, the "opensshd.init" binary to restart the service was not in the location referenced in the README.md.

Fix via ADB : adb shell su /sbin/.magisk/modules/ssh/opensshd.init restart

lemmy04 commented 5 years ago

so how can this be permanently fixed? the restart hasto be done manually after each device restart. Can't really automate backups or anything that way.

lemmy04 commented 5 years ago

any way to have a permanent fix for this? or maybe some "dirty hack" with tasker that would run the restart command after a reboot, and on each connectivity change?

lemmy04 commented 5 years ago

..anyone got any ideas?

pida42 commented 4 years ago

..anyone got any ideas?

Maybe... I can login with root, but I have to:

jbsky commented 3 years ago

Hello,

Please, connect with adb shell, and check your file if has a the format. I look my public key in authorized_keys files with a space between each charactere. So, it can't working...

Best regard.

Julien

ReMiA00 commented 3 years ago

@lemmy04 -- I had the same issue. Restarting the SSH service seemed to have fixed it for me, I'm not sure why. Also, the "opensshd.init" binary to restart the service was not in the location referenced in the README.md.

Fix via ADB : adb shell su /sbin/.magisk/modules/ssh/opensshd.init restart

Thanks !

Changing the /data/adb/modules/ssh/service.sh makes it permament A bit ugly fix, since the path prefix should be a environment variable

#!/system/bin/sh
# Do NOT assume where your module will be located.
# ALWAYS use $MODDIR if you need to know where this script
# and module is placed.
# This will make sure your module will still work
# if Magisk change its mount point in the future
MODDIR=${0%/*}

# This script will be executed in late_start service mode
# [ -f /data/ssh/no-autostart ] || $MODDIR/opensshd.init start (original line)
[ -f /data/ssh/no-autostart ] || /sbin/.magisk/modules/ssh/opensshd.init start