Supercomputer
How to Use SSH Port Forwarding
How to Use SSH Port Forwarding
SSH Port Forwarding is a method used to forward data.
Data to be sent to a particular port of a local machine can be forwarded to a particular port of a remote machine using a separately prepared (and coded) communication pathway.
By going through 'gw', files can be uploaded to a machine (in this case 'sm') that refuses direct login. The procedure for uploading is given below.
For Linux
For SSH port forwarding, connect the local machine port number 9000 to the 'sm' port number 22 through 'gw'.
Local machine:ssh -L 9000:sm.hgc.jp:22 gw.hgc.jp -l username
When you login for the first time, a message similar to the one below will be displayed.
username@gw.hgc.jp's password: xxxxxxx <- Please enter the 'gw' login password.
Leave this terminal as logged in.The authenticity of host '[localhost]:9000' can't be established. RSA key fingerprint is 79:94:de:ba:32:f2:6a:4b:f2:23:ee:f0:d2:db:aa:c3. Are you sure you want to continue connecting (yes/no)? yes
Please enter 'yes' to this message.- * The port number for setting up the local machine can be any number above 1023 that is not in use.
- * Please change the local machine port number when uploading a file to a machine other than 'sm' (e.g., c101).
Upload files to the 'sm' work directory from the local machine.
Open a new terminal.
Local machine:scp -P 9000 filename username@localhost:/work/username/filename
Please click here for details on scp usage.
- * 9000 is the local machine port number specified earlier.
For Windows
For SSH port forwarding, connect the local machine port number 9000 to the 'sm' port number 22 through 'gw'.
Please use ssh-compatible software such as PuTTY.
PuTTY : http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Enter 'gw.hgc.jp' as the 'Host Name' for the 'Session'.
In the 'Host Name' column of 'Connection' -> 'SSH' -> 'Tunnels', enter '9000', and in the 'Source port' column, enter 'sm.hgc.jp:22'. Click 'Add' and then 'Open'.
A message similar to the one below will be displayed when you login for the first time.
The authenticity of host 'gw.hgc.jp (202.175.151.XX)' can't be established.
Please enter 'yes' to this message.
RSA key fingerprint is 79:94:de:ba:32:f2:6a:4b:f2:23:ee:f0:d2:db:aa:c3.
Are you sure you want to continue connecting (yes/no)? yesPlease enter the username and password when you login to 'gw'.
Upload the file to the 'sm' home directory from the local machine.
Please use sftp-compatible software such as WinSCP or Filezilla.
WinSCP : http://winscp.sourceforge.net/eng/download.php
FileZilla : http://sourceforge.net/projects/filezilla/
Enter 'localhost' as the 'Host name' and '9000' as the 'Port number ' for the 'Session'. Enter the 'gw' username as the 'User name' and your password as the 'Password'; then click 'Login'.
- For WinSCP
- To specify the directory after logging in, please set up 'Environment' -> 'Directories' -> 'Remote directory' (this will be /home/username by default).