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

  1. 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
    username@gw.hgc.jp's password: xxxxxxx <- Please enter the 'gw' login password.
    Leave this terminal as logged in.

    When you login for the first time, a message similar to the one below will be displayed. 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).
  2. 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

  1. 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

  2. Enter 'gw.hgc.jp' as the 'Host Name' for the 'Session'.

    PUTTY login setting

  3. 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'.

    PUTTY tunnels setting

    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.
    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.

  4. Please enter the username and password when you login to 'gw'.

    Login

  5. 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/

  6. 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

    WinSCP login setting

    To specify the directory after logging in, please set up 'Environment' -> 'Directories' -> 'Remote directory' (this will be /home/username by default).

    WinSCP directory setting

Top of Page Top of Page

The University of Tokyo The Institute of Medical Science

Copyright©2005-2017 Human Genome Center