2moe / tmoe

TMOE, More Optional Environments.
https://doc.tmoe.me
Other
867 stars 80 forks source link

SSH server not be able to start #72

Closed greatbody closed 3 years ago

greatbody commented 3 years ago

Are you using tmoe?

Yes

Are you rooted?

No

What is your desktop environment?

🦖 kde plasma

Describe the bug

I installed ssh by

apt install openssh-server

But cannot start this server.

service ssh status

Report not started.

How to reproduce

Xiaomi 6 unrooted Running Termux as emulater

Install Ubuntu with the script.

Expected behavior

Expect can ssh to phone

Screenshots

no photo

Error Logs

no error message

What is the container type?

proot

Configuration

container value
distro ubuntu-devel
arch arm64

host value
os android-11
arch arm64
terminal Termux
tmoe latest

Additional context

No response

greatbody commented 3 years ago

Found reason, cannnot bind port 22.

iShot2021-10-15 10 53 00

But I am running it with root account.

2moe commented 3 years ago

Please use a port between 1024 and 65535.


First, edit sshd config.

editor /etc/ssh/sshd_config

Then, find "#Port" and "#PermitRootLogin"

2021-10-15 11 28 41

And then, modify Port & PermitRootLogin:

Port 12345
PermitRootLogin yes

Then, save file and exit the editor.

If you don't know the root password, then type passwd It is recommended to use the ed25519 key instead of the password.

Finally, restart ssh server.

service ssh restart
service ssh status
ssh -p 12345 root@localhost

You can try ed25519.

ssh-keygen -t ed25519
ssh -p 12345 -i ~/.ssh/id_ed25519 root@localhost
greatbody commented 3 years ago

Please use a port between 1024 and 65535.

First, edit sshd config.

editor /etc/ssh/sshd_config

Then, find "#Port" and "#PermitRootLogin" 2021-10-15 11 28 41 And then, modify Port & PermitRootLogin:

Port 12345
PermitRootLogin yes

Then, save file and exit the editor.

If you don't know the root password, then type passwd It is recommended to use the ed25519 key instead of the password.

Finally, restart ssh server.

service ssh restart
service ssh status
ssh -p 12345 root@localhost

You can try ed25519.

ssh-keygen -t ed25519
ssh -p 12345 -i ~/.ssh/id_ed25519 root@localhost

EN: I know this can work, but WHY as root cannot bind to 22 port? That does not make sense to all.

CN: 我知道这样可以,我也是这么试过可以连接上。但是,一个技术人员的追求告诉我,一定要刨根问底,为啥 sudo 都不能用 22 端口。这不🦫

2moe commented 3 years ago

Opening ports below 1024 requires root privileges. The proot container is not real root.

greatbody commented 3 years ago

EN: A guess. Since I an using Android device to do it, and this is an unrooted device, I seems to get the answer. Because port binding at last will be forwarded to Android App, which is Termux, and since this device is not rooted, Androd will not allow binding 22 port.

CN: 我有一个猜测。因为我用的是安卓设备,并且它没有被root,所以这似乎是答案。因为端口绑定最终会落到安卓段,也就是Termux,由于我的设备没有root,所以安卓不会允许 Termux 绑定 22 端口。

2moe commented 3 years ago

You're right.

greatbody commented 3 years ago

Opening ports below 1024 requires root privileges. The proot container is not really root.

EN: Yes, the root in proot container actually mean that you can do anything within that container, but if you reach outside of the container, you are constraint by Android system which is my host OS.

CN:是的,proot容器中的root仅仅意味着你可以在容器中为所欲为,但是如果你尝试接触容器外的世界,就会被我所用的安卓系统束缚。

greatbody commented 3 years ago

EN: Am not sure if this is in any part of the document, if not, I suggest that you add it, so other will save the time to find a way to bind ports that is below 1024 and with unrooted device.

CN: 我不清楚文档里面有没有写这个,如果没有,还是建议你加一句,这样可以给其TA想办法开1024以下端口的但是又没有root设备的人节省时间。

2moe commented 3 years ago

Thanks, I'll add it.