Remote Access - Linux File System

Occasionally it will be beneficial to have remote access to the Linux filesystem that is used in the Computer Science labs. Access is automatically available for all students enrolled in a Computer Science class; no extra permissions are needed. Instructions for accessing your /home/<username>/ directory can be found below.

Access to your home directory is accomplished through SSH. Most openssh-compatible SSH programs/SFTP programs will be compatible with our systems, but these directions will cover only common supported ones. In these directions, we will cover generating an SSH keypair, uploading it to the cs-ssh system, and using it within a common client to connect to our cs-ssh server. This process is required for all off-campus connections into our server infrastructure.

If you need help with this process, please contact Chris Wieringa, CS Lab Manager, through the Contact page.


Select a button above for directions.

Windows

For access both on-campus and off-campus for Windows, we will use the Bitvise SSH client. After installing, we'll generate an SSH keypair and upload the public key to the cs-ssh server..

  1. Download Bitvise SSH Client (Tunnelier) and install it.
  2. Launch Bitvise SSH client.

  3. In this next section, we will generate SSH keys for use. This only needs to be done once.

  4. Select Client key manager.
    1. Click the Generate New button.
    2. In the "Generate New Keypair" dialog box, fill in:
      • Algorithm: RSA
      • Size: 4096 (Note: this is the strength of your SSH key, 3072 and above is fine, but 4096 is recommended.)
      • For passphrase, this passphrase is specifically for your SSH private key. This is NOT your Computer Science password, but a password to decrypt your SSH private key.

      • Passphrase: <a password for your SSH private key>
      • Confirm Passphrase: <your password for your SSH private key again>
      • Click the Generate button to continue.
    3. Click the Export button to start the process to export your public key.
    4. In the "Export Public or Private Key" dialog box, click Export Public Key and OpenSSH format.
    5. Click the Export button to continue.
    6. Select a location to save your public key. Name it whatever you like, but I'd recommend <username>.pub. Remember where you exported this public key.

    7. In this section, we need to upload your SSH public key to the cs-ssh server. While you can perform the manual steps described below, I would recommend utilizing the Linux - Upload SSH Public Key webpage to perform these operations. You can access that webpage regardless of whether you are on-campus or off-campus. If you want to perform these steps manually instead of using the upload form, then please note that this section must be performed on-campus!

      Manual steps (skip to step 4 if you upload using the form above.)

    8. Within Bitvise, go to the "Login" tab. Fill in the following information:
      • Host: cs-ssh.cs.calvin.edu
      • Port: 22
      • Username: <your username>
      • Initial method: password
    9. Click Login.
    10. If prompted, accept and save any host SSH keys.
    11. When the terminal opens, if a SFTP window does not open, click the "New SFTP window" button to open a SFTP window.
    12. In the SFTP Window and the "Remote Files" section, check if a ".ssh" folder exists. IF it does, skip to the next step. If not, follow the instructions below:
      1. In the "Remote Files" section, right-click anywhere to bring up the menu and click "Create folder" and name it ".ssh"
      2. Once created, right-click on the ".ssh" folder and choose "Properties".
      3. In Properties, click the "Permissions" tab.
      4. Change the permissions numerically to the "Numerical: 700"
      5. Click "OK" to close out the properties.
    13. In the "Remote Files" section, double-click the ".ssh" folder to change into it.
    14. In the "Local files" section, change your directory to where you saved your exported public key above.
    15. Copy your exported public key to the remote ".ssh" folder by dragging it from the "Local files" to the "Remote files" section.
    16. Click once on your uploaded public key file, and rename it to the name: authorized_keys
    17. Right-click on the "authorized_keys" file, and go to Properties.
    18. In Properties, click the "Permissions" tab.
    19. Change the permissions numerically to the "Numerical: 600"
    20. Click "OK" to close out the properties.
    21. Close out the SFTP Window, and the main Terminal window, and "Log out" from the ssh connection.

  5. In this section, we'll make our private / public keyfile connection to the cs-ssh server.

  6. In the "Login" main menu, fill in the following values:
    • Host: cs-ssh.cs.calvin.edu
    • Port: 22
    • Username: <your username>
    • Initial method: publickey
    • Client key: Global 1 (Note: whatever the index was of the key you just generated.)
    • Passphrase: <your SSH private key passphrase>
  7. Click Login.
  8. If prompted, accept and save any host SSH keys.

At this point, you should be logged into cs-ssh under your username. You may click the "New SFTP window" to get a graphical UI for transferring files.


Note: if you are upgrading from an older version of BitVise, you may need to enable additional SSH key exchange methods.

  1. Open BitVise
  2. Select the SSH tab along the top of the screen.
  3. Click the "Key Exchange" link.
  4. Make sure the following are selected:
    • Curve25519
    • diffie-hellman-group-exchange-sha256
    • ECDH/nistp384
Mac OS X

For Mac operating systems, we will be utilizing native OpenSSH tools. These tools are pre-installed in all modern Mac OS X installations.

In this section, we will generate our SSH private and public keys.

  1. Open a Terminal window. (Finder - Applications - Utilities - Terminal).
  2. Run the command: ssh-keygen -b 4096 -t rsa
  3. By accepting the default file location, your public and private keys are saved to /Users/<username>/.ssh/. Your private key is named "id_rsa", while your public key is named "id_rsa.pub".

  4. View the contents of your public key by running the command: cat .ssh/id_rsa.pub

In this section, we need to upload your SSH public key to the cs-ssh server. While you can perform the manual steps described below, I would recommend utilizing the Linux - Upload SSH Public Key webpage to perform these operations. You can access that webpage regardless of whether you are on-campus or off-campus. If you want to perform these steps manually instead of using the upload form, then please note that this section must be performed on-campus!

Manual steps (skip to step 5 if you upload using the form above.)

  1. In the terminal, run the command: ssh-copy-id <username>@cs-ssh.cs.calvin.edu filling in <username> with your username. For example: ssh-copy-id jcalvin@cs-ssh.cs.calvin.edu
    Follow the prompts and type your password in until it has copied your key over to the server.
  2. While the ssh-copy-id program copied our keyfile over, we need to fixup the permissions before we can utilize the public key. Log into cs-ssh using your password by typing the command: ssh <username>@cs-ssh.cs.calvin.edu .
  3. Once logged in, issue the following commands:
    1. chmod 700 .ssh
    2. chmod 600 .ssh/authorized_keys
  4. Close out your cs-ssh connection; it's time to try it with the public key. Type: exit
  5. Try to log in with your private / public key: ssh <username>@cs-ssh.cs.calvin.edu filling in <username> with your username. For example: ssh jcalvin@cs-ssh.cs.calvin.edu
    If prompted for your private key password, type it in.

At this point, you can continue using common command line tools from a terminal. Launch Terminal and follow the directions for Command Line connections.

Command Line Operations

Using OpenSSH tools, we can get a remote console or copy files using the scp program. This section assumes that you have generated your SSH keys, and uploaded them into the cs-ssh server. See the specific operating system instructions for more details.

Remote Console

ssh <username>@cs-ssh.cs.calvin.edu
Example: ssh jcalvin@cs-ssh.cs.calvin.edu

Remote File Transfer

scp <localfile> <username>@cs-ssh.cs.calvin.edu:/home/<username>/<remotefilename>
Example: scp project1-results.txt jcalvin@cs-ssh.cs.calvin.edu:/home/jcalvin/project1/project1-results.txt. Note: You can just supply a folder path, and the file name will be assumed.

Remote File Transfer - Recursive Directory

scp -r <somefolder> <username>@cs-ssh.cs.calvin.edu:/home/<username>/<remotefolder>/
Example: scp -r proj1 jcalvin@cs-ssh.cs.calvin.edu:/home/jcalvin/

Linux

For Linux operating systems, we will be utilizing native OpenSSH tools.

In this section, we will generate our SSH private and public keys.

  1. Open a Terminal window.
  2. Run the command: ssh-keygen -b 4096 -t rsa
  3. By accepting the default file location, your public and private keys are saved to /home/<username>/.ssh/. Your private key is named "id_rsa", while your public key is named "id_rsa.pub".

  4. View the contents of your public key by running the command: cat .ssh/id_rsa.pub
  5. Select and copy the complete contents of your public key, starting with "ssh-rsa" all the way to the end of the file.

In this section, we need to upload your SSH public key to the cs-ssh server. While you can perform the manual steps described below, I would recommend utilizing the Linux - Upload SSH Public Key webpage to perform these operations. You can access that webpage regardless of whether you are on-campus or off-campus. If you want to perform these steps manually instead of using the upload form, then please note that this section must be performed on-campus!

Manual steps (skip to step 5 if you upload using the form above.)

  1. In the terminal, run the command: ssh-copy-id <username>@cs-ssh.cs.calvin.edu filling in <username> with your username. For example: ssh-copy-id jcalvin@cs-ssh.cs.calvin.edu
    Follow the prompts and type your password in until it has copied your key over to the server.
  2. While the ssh-copy-id program copied our keyfile over, we need to fixup the permissions before we can utilize the public key. Log into cs-ssh using your password by typing the command: ssh <username>@cs-ssh.cs.calvin.edu .
  3. Once logged in, issue the following commands:
    1. chmod 700 .ssh
    2. chmod 600 .ssh/authorized_keys
  4. Close out your cs-ssh connection; it's time to try it with the public key. Type: exit
  5. Try to log in with your private / public key: ssh <username>@cs-ssh.cs.calvin.edu filling in <username> with your username. For example: ssh jcalvin@cs-ssh.cs.calvin.edu
    If prompted for your private key password, type it in.

At this point, you can continue using common command line tools from a terminal. Launch Terminal and follow the directions for Command Line connections.

On-campus

If you are on the Calvin campus network (whether via WiFi or Ethernet), you are allowed to connect into the CS servers without using an SSH keypair, by just using your Computer Science Linux password. For ease of use, all operating systems on-campus can use the FileZilla client. NOTE: If you are already set up using your SSH private and public keys, use that method instead.

  1. Download FileZilla and install it. (Note: pick the 32-bit or 64-bit as appropriate for your operating system; it won't make any difference to these directions.)
  2. Launch FileZilla.
  3. Goto File -> Site Manager
  4. Click the New Site button.
    • Name your site: cs-ssh
    • Host: cs-ssh.cs.calvin.edu
    • Port: 22
    • Protocol: SFTP - SSH File Transfer Protocol
    • Logon Type: Ask for password
    • User: <your username>
    Click OK.
  5. Click the Connect button down-arrow, and select "cs-ssh".
  6. Type your password when prompted.

Once connected, you can drag-and-drop files into your remote home directory.

Filestash

Computer lab filesystems can be accessed via a web-based file manager called Filestash from https://github.com/mickael-kerjean/filestash. Linux /home/ directories can be directly accessed via your browser. Files can be dragged to the window (upload box at the top!) to upload files to the system.

Calvin CS Filestash