HOWTO: ssh to matrix from Debian

Step 1: Start VPN

You have a choice to run the VPN on either your Windows/macOS host or from the Linux guest VM. Running from the Windows/macOS host is sufficient and recommended in most cases, however, for those adventurous enough to explore the more challenging alternative, you can run the VPN directly from the Linux guest.

(EASY) VPN on Windows/macOS host

  1. Connect to Student Virtual Private Network
  2. From VM connect directly to matrix using ssh. You can safely skip the ADVANCED section below and go to Step 2: ssh to matrix

(ADVANCED) VPN only in VM

  1. Install openconnect. Ensure up-to-date /etc/apt/sources.list

    Your /etc/apt/sources.list should look like this:

    deb http://deb.debian.org/debian/ bullseye main contrib non-free
    deb-src http://deb.debian.org/debian/ bullseye main contrib non-free
    
    deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
    deb-src http://deb.debian.org/debian/ bullseye-updates main contrib non-free
    
    deb http://security.debian.org/debian-security bullseye/updates main contrib non-free
    deb-src http://security.debian.org/debian-security bullseye/updates main contrib non-free
    
  2. Install packages necessary for VPN

    apt update
    apt install curl wget openconnect sshpass tree vim vim-gtk3
    
  3. Download vpn script to connect to matrix

    • Start a terminal session (select Terminator icon from the status bar).


    • Type the following commands. NOTE: Do not type lines starting with # but type everything after the lines starting with $ (everything after the $).

      # download the vpn script
      $ wget itas.senecacollege.ca/~mark.fernandes/vpn
      
      # change the permission after downloading
      $ chmod +x vpn
      
      # move vpn to /usr/bin
      $ sudo mv vpn /usr/bin
      
      # run the vpn script
      $ vpn
      

    You will see the following output

    Usage: vpn [-c|connect] | [-d|disconnect] | [-f|flush] | [-i|info]
    
  4. Connect to Seneca's Virtual Private Network

    To connect to Seneca's VPN (Virtual Private Network) run the following command and follow the prompts using your MySeneca username and password when asked (NOTE: your password wont display on the screen as you type it and remember to press ENTER when done.):

    $ vpn -c
    

    This will start the connection and when you authenticated the script will continue to remain in the foreground.

Step 2: ssh to matrix

Open another terminal window (CTRL+SHIFT+t or ALT+F2) while the VPN connection is active and run the following command

# replace the text <MySeneca-username> with your MySeneca username
$ ssh <MySeneca-username>@matrix.senecacollege.ca

You will be asked to continue connecting. Answer (type the word) yes. When prompted for your password enter it (NOTE: your password wont display on the screen as you type it and remember to press ENTER when done).

Copy files from remote (matrix) to local (Debian)

Open another terminal window (CTRL+SHIFT+t or ALT+F2) while the VPN connection is active and run the following command

# check contents of your directory before copying
$ ls

# copy from remote using scp replacing <MySeneca-username> with your MySeneca username
$ scp -r <MySeneca-username>@matrix.senecacollege.ca:~mark.fernandes/ops105/notes mf-notes
# check contents of your directory after copying
$ ls

# change directory into mf-notes and check contents
$ cd mf-notes
$ ls

When prompted for your password enter it (NOTE: your password wont display on the screen as you type it and remember to press ENTER when done).

Log out and disconnect from VPN

  • To logout from the ssh session press CTRL+d
  • To disconnect from the VPN session use

    # close VPN session
    vpn -d
    

Troubleshoot Known Issues

Last Updated: 2021-Sep-20 Mon 13:38