A quick tutorial that makes your remote server work as a local one.

Before you start


Configure SSH Key to log in remote server

  1. launch a terminal in the local machine, excute the following command:

    ssh-keygen
    

    input Enter for all the following steps and then you will find two files generated in ~/.ssh folder:

    id_rsa
    id_rsa.pub
    

    excute the following command:

    ssh-copy-id [username]@[host]
    # if you log in to your lab server via Liverpool gateway, 
    # the host should be the host_gateway: ssh1.csc.liv.ac.uk
    

    input passwords and then you should log in to the remote server successfully.

  2. now let us have a sanity test:

    # 1/2: Log in to the gateway
    ssh [username]@[host_gateway]
    # 2/2: Log in to your lab server
    ssh [host_lab]
    
    ### Here is my configuration for your reference ###
    # 1/2
    ssh [email protected]
    # 2/2
    ssh rahul2
    

    if in both steps you are not asked for a password (since we have configured the SSH keys), then you can safely move on to the next step. Otherwise, check carefully and repeat the previous steps.

  3. configure a shortcut to log in to the remote server

    cd ~/.ssh
    touch config
    

    open config with an editor and write the following configurations:

    Host [customized_name_1]
        HostName [host_gateway] 
        User [username]
    
    Host [customized_name_2]
        HostName host_lab
        User [username]
        ProxyCommand ssh [username]@[host_gateway] nc %h %p
    
    ### Here is my configuration for your reference ###
    Host liv
        HostName ssh1.csc.liv.ac.uk
        User ramdrop
    Host rahul2
        HostName rahul2
        User ramdrop
        ProxyCommand ssh [email protected] nc %h %p
    

    now you shou be able to log in to the remote server with the shourcuts above:

    ssh [customized_name_1]
    # or
    ssh [customized_name_2]
    
    ### Here is my commands for your reference ###
    # log in to the gateway
    ssh liv
    # or log in to the lab server directly
    ssh rahul2
    

Install VS Code (Mac/Ubuntu)

Follow the official instructions: https://code.visualstudio.com/

Install Extensions in VS Code