Closed greatbody closed 3 years ago
Found reason, cannnot bind port 22.
But I am running it with root account.
Please use a port between 1024 and 65535.
First, edit sshd config.
editor /etc/ssh/sshd_config
Then, find "#Port" and "#PermitRootLogin"
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
Please use a port between 1024 and 65535.
First, edit sshd config.
editor /etc/ssh/sshd_config
Then, find "#Port" and "#PermitRootLogin" 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 端口。这不🦫
Opening ports below 1024 requires root privileges. The proot container is not real root.
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 端口。
You're right.
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仅仅意味着你可以在容器中为所欲为,但是如果你尝试接触容器外的世界,就会被我所用的安卓系统束缚。
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设备的人节省时间。
Thanks, I'll add it.
Are you using tmoe?
Yes
Are you rooted?
No
What is your desktop environment?
🦖 kde plasma
Describe the bug
I installed ssh by
But cannot start this server.
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
Additional context
No response