Connecting to a server

Karen Cristine Goncalves, Ph.D.

2023-01-26

Logging in

  • Click on Session -> SSH
  • Add the Remote Host : cedar.computecanada.ca
  • Click on Specify username then add yours
  • Click OK: will ask your password (when you type, nothing will appear, but it is writing)

Logging in

  • ssh cedar.computecanada.ca
    • Will ask your user name then your password (what you type won’t appear on the screen)
  • ssh YOUR_USERNAME@cedar.computecanada.ca
    • Replace YOUR_USERNAME with your username, in my case: karencgs
    • Will ask your password

Server organization

  • In the server, type (do not consider what comes after #):

pwd # after you log in, should be /home/username/
whoami # username
echo "$SCRATCH"
echo "$HOME"
ls $HOME/projects/

  • $HOME : Store scripts, software files, things you use frequently without necessarily modifying them
  • $SCRATCH : Use to run scripts, submit jobs (scripts that take too long or use a lot of resources)
  • /projects/ : Use as medium to long term storage (raw data, final results of analyses), share files with people of the same project
    • Check file authorizations so that other can use what you share

Transfer files to server

  • In MobaxTerm, log in to the server, click on the left panel on the world button (SFTP)
  • Left panel: buttons for upload, download, etc.
  • Under the buttons is a bar to put the path to the desired folder
  • Once you are in the folder you want, click on a file and click the button for download to select where you want to save it

Transfer files to server

  • In MobaxTerm, create a SFTP session (like an SSH session)

Transfer files to server

  1. Folders in your computer
  2. Content of folder selected in panel 1
  3. Folders in the server
  4. Status of the connection and of transfers

Transfer files to server

  • rsync : FROM YOUR COMPUTER TO THE SERVER!!!! - Never from the server to your computer (for security)
    • To enter path to server, you need to add the log in info

    • Path to file(s) to transfer

    • Path to destination

      # Type the following in your computer's terminal (not in the server!!!)
      rsync file_in_computer username@cedar.computecanada.ca:/home/username/
      # Will ask for password to server
      # copies file_in_computer to the server in the folder /home/username
      
      rsync username@cedar.computecanada.ca:/home/username/file_in_server ./
      # Will ask for password to server
      # copies /home/username/file_in_server from the server my computer
      

Exercise - transfer fasta file

  • Download this fasta file to a folder of your choice in your computer
  • Use rsync to transfer it to the server in a folder called unix_class in $HOME
  • Edit the file with nano and remove two sequences, save to another file.
  • Transfer new file to your computer using rsync

Resources