Jack's Blog

流淌的心,怎能阻拦,吹来的风,又怎能阻挡。

科学计算基础——ssh实现校园网内超级计算机的访问

Jacob posted @ Oct 07, 2018 01:53:34 PM in 未分类 with tags ssh 科学计算 , 2768 阅读

一、背景

我的导师呢,主要工作是进行数值计算的工作,对计算机的要求较高。于是呢便花了80万购置了几台曙光服务器专门跑计算(夸张了点还是叫它超算)。由于超算的噪音很大,同时还要考虑其散热问题,于是我们便专门定制了隔间。然而,他当时给他自己挖下了个大坑,招了5个第三世界的博士生和博士后(唉,其中一个印度人身上简直咖喱味爆棚啊),然后导致...办公室地方紧张,进出超算房间的唯一入口被堵死了。好吧,这下又有任务了,导师叫我试着能不能在局域网内大家自己的电脑(其实主要是我和他的电脑)访问一下这台超算。然而有了之前NAS的经验,我知道,只要将ssh配置好,只要我在校园网内部,就可以使用任意一台智能终端访问这台超算。其实我们有静态IP,理论上从任何一个地方都可以访问这台超算,然而这都是后话了。嘿嘿嘿,等我快毕业了再说吧。

我们的配置有

  • 几台已经安装过Ubuntu并配置成功的服务器
  • 静态IP
  • 一台NETGEAR的高端路由器

还有无数个坐等吃山的师兄(好吧,我是最小的)。

二、方法

要建立ssh隧道

1.需要在服务器端和用户端都安装好ssh

sudo apt-get install openssh-client
sudo apt-get install openssh-server

接着查看进程,看看 ssh-agent 是否运行,如果没有,输入下面指令启动 ssh 服务进程。

sudo service ssh start

关闭进程:

sudo service ssh stop

2.接下来配置sshd

 

3.在局域网路由器内设置映射关系

1)绑定局域网内所连接的IP与电脑的MAC地址。

2)然后,在路由器上找到:转发规则-虚拟服务器,点击添加新条目

端口号写:22,然后加入linux PC所对应的IP地址。(Linux 机器上的端口号是22,所以为了方便Windows下ssh登录方便,故设置为22)

3)保存设置

然后就大工告成了

ssh -X username@ip address -p 22

其中,22为所设定的端口号。

现在就可以用 ssh 远程登录到局域网内的电脑,指令格式:

ssh usr\@hostname
ssh usr\@ip

执行这个命令后会让你输入密码,只要输入 usr 的密码就行了。如果是首次连接,那么 Server 会问您,您的联机的 Key 尚未被建立,要不要接受 Server 传来的 Key ,并建立起联机呢?呵呵!这个时候请务必要输入 yes 而不是 y 或 Y,这样程序才会接受喔!


如果想删除通过 ssh 登录到主机上的一些用户可以使用下面命令:

pkill -kill -t pts/1


如果想进行文件的传输可以使用如下指令:

从机向主机传文件:
主机:nc -l [端口号] > 文件名
从机:nc [主机IP] [端口号] < 待传文件名

三、评价

  • 无匹配
Avatar_small
how to delete spotif 说:
2022年8月10日 17:07

Love listening to music but using Spotify is not your cup of tea anymore then you are precisely correct about deleting your account, and even precise to land on this article, because 99networks will show you how to delete your Spotify account permanently as well. how to delete spotify account We all know that sometimes some of our preferences and choices in life become an addiction. Sometimes they come with a big price. One such example here is the Spotify which might put you through a continuous music streaming world. Also you have to pay for the account which becomes one big hassle.

Avatar_small
Emma 说:
2023年1月13日 22:37

SSH or Secure Shell is a cryptographic network protocol for operating network services securely over an homes for sale in Sherman Oaks unsecured network. The best known example of a service that uses SSH is remote login into another computer. SSH can also be used to securely transfer files and to tunnel network traffic.

Avatar_small
+1 Blueprint 2024 说:
2023年2月11日 21:47

Board of School Education Announced the Board 11th class Blueprint. It is the responsibility of schools to conduct the examination at their own pace and decide the New Blueprint. +1 Blueprint 2024 Get the latest 1st Inter Blueprint 2024 and Download the Board 11th Blueprint on its official website. Blueprint 2024 for 11th Class and start preparation according to the exam New Blueprint 2024 to score in Board exam.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter