Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] 为ssh连接方式添加指定端口选项 #5

Closed
SeeFlowerX opened this issue Jun 21, 2022 · 7 comments
Closed

[Feature request] 为ssh连接方式添加指定端口选项 #5

SeeFlowerX opened this issue Jun 21, 2022 · 7 comments

Comments

@SeeFlowerX
Copy link

SeeFlowerX commented Jun 21, 2022

有时候受限于PC的网络环境,比如手机和PC在不同的子网下,这个时候在虚拟机中无法连通到手机的ssh(即使手机监听0.0.0.0)

如果这个时候仍然想使用ssh去操作,可以通过adb forward tcp:手机端口 tcp:PC端口进行转发

然后PC可以通过ssh root@127.0.0.1 -p port的方式连接到手机的ssh

但是adb forward tcp:22 tcp:22怎么都会提示无法绑定端口,但是如果是其他端口却可以成功...

image

image

另外补充一点,ssh连的时候,forward的手机端口和PC端口必须一致,不知道为何...


所以希望可以增加一个指定端口的选项,另外项目是用的scp传输文件,改的话也需要一并增加

@tiann
Copy link
Owner

tiann commented Jun 21, 2022

你是让手机上的 ssh 监听在 22222 端口吗?

@SeeFlowerX
Copy link
Author

第一张图是监听22

第二张图是监听22222

@tiann
Copy link
Owner

tiann commented Jun 21, 2022

b3fbb27 试下这个是否可以?

@SeeFlowerX
Copy link
Author

谢谢大佬,可以了

不过这个位置是不是也应该是大写的P

@tiann
Copy link
Owner

tiann commented Jun 21, 2022

ssh 用 -p https://linux.die.net/man/1/ssh
scp 用 -P https://linux.die.net/man/1/scp ,应该是没毛病的

@SeeFlowerX
Copy link
Author

嗯呢

@Gunkkk
Copy link

Gunkkk commented Jul 14, 2023

请问下这种情况下root密码是多少,为什么passwd改了密码都没有效果的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants