终端远程连接家中ubuntu

来源:互联网 发布:linux命令行安装oracle 编辑:程序博客网 时间:2024/05/02 00:34

一直使用TeamViewer访问家中的主机,最大的问题就是网络,卡的让人疯掉。其实只是希望连接主机写个脚本执行个算法什么的,控制台就够了,上午折腾了一下,成功了,这里记录。

做之前,可以参考知乎https://www.zhihu.com/question/27771692,看看是否有更喜欢的方案。

这里实现 ngrok + secureCRT


1、去https://ngrok.com/注册账号,得到authtoken

2、 远程登录到被登录主机

控制台wget 安装ngrok

        加载key, 也即在控制台执行./ngrok authtoken __这里是刚获得的key__

        ./ngrok ssh 22

        会看到启动效果,结果中有username@0.tcp.ngrok.io -pxxxx一句,记下来。

3、在SecureCRT中新建Session,也就是连接,选SSH2,下一步,HostName填0.tcp.ngrok.io,用户名填上面的username,端口填-p后的xxxx,登录。

      一般情况下就OK了,如果不OK,显示“The client has disconnected from the server.  Reason: Unable to authenticate using any of the configured authentication methods. ”的话,按照http://bbs.qcloud.com/thread-13049-1-1.html修改修改/etc/ssh/sshd_config的PasswordAuthentication项。

4、连接。OK。

0 0