Working Remotely on the Mac

1. Direct SSH Connection

  1. Open up a terminal window. To do so, got to Applications->Utilities->Terminal.
  2. Type the following at the prompt where username is your Computer Science account user name.
    	  ssh -l username -Y -p 222 cs101.cs.gettysburg.edu
    	
  3. You will be prompted for a password, enter your password for the CS workstations.
You can replace cs101 with any machine from cs101 to cs125. You cannot run graphics applications until you complete the next step.

2. Graphical Applications

If you want to run graphics applications on the CS workstations and display them on your own macnine, do the following:
  1. From the Apple Menu, open System Preferences...
  2. Click on "Security and Privacy" and open the "General" tab.
  3. Click the Lock at the bottom left corner of your screen, and enter your password.
  4. Select "App Store and identified developers" under "Allow apps downloaded from:"
  5. Download the program XQuartz from https://www.xquartz.org/. It will download a .dmg file; open it.
  6. Double click on XQuartz.pkg and follow the instructions. Note there is no longer an X11.app that this is replacing.
  7. Open a terminal and run the command from the first section. Once you are logged in, run a graphical application like gedit. XQuartz should open automatically and the program window will show up on your screen.
  8. The first time XQuartz runs, your Mac may ask you if you really want to run this program.
If you get an error running JavaFX programs from eclipse using ssh/XQuartz, see section 6.

3. Simplifying the SSH Connection

That ssh command is a lot to remember, there are some steps you can take to simplify things for yourself.

Configure your ssh client

The following steps will let you simplify the ssh command to ssh cs101
  1. Open a terminal on your Mac and change into the .ssh directory.
    	  cd .ssh
    	
    If you see a message like .ssh: No such file or directory, create the directory yourself.
    	  mkdir .ssh
    	  cd .ssh
    	
  2. Edit the file config using the editor pico.
    	  pico config
    	
  3. Add the following lines to the file replacing username with your CS user name.
    Host *.gettysburg.edu
    ForwardX11 yes
    ForwardX11Trusted yes
    Port 222
    User username
    
    Host cs*
    ForwardX11 yes
    ForwardX11Trusted yes
    Port 222
    User username
    	
  4. In pico, the most common commands are at the bottom of the screen. The ^ indicates the use of the control key. The letters do not have to be capitalized. To save your changes, type control-o (for WriteOut). This is what happens when programmers are responsible for user interface design.
  5. It will prompt you for a file name which should already be config. Hit enter.
  6. Type control-x to exit pico.

Configure your /etc/hosts files

The following steps will let you simplify the ssh command to ssh cs1
  1. Open a terminal, and change to the computer's /etc direcotry.
    	  cd /etc
    	
  2. Make a backup copy of the hosts file. Note this has to be done as administrator. It will prompt you for your Mac password.
    	  sudo cp hosts hosts.bak
    	
  3. Edit the hosts file with pico. This time it may not prompt for a password, unless it has been a few minutes since you used sudo.
    	  sudo pico hosts 
    	
  4. Add the following lines to the end of the file. You can copy and paste these, but move your cursor to the end of the file before you do.
    138.234.44.101  cs101.cs.gettysburg.edu cs101
    138.234.44.102  cs102.cs.gettysburg.edu cs102
    138.234.44.103  cs103.cs.gettysburg.edu cs103
    138.234.44.104  cs104.cs.gettysburg.edu cs104
    138.234.44.105  cs105.cs.gettysburg.edu cs105
    138.234.44.106  cs106.cs.gettysburg.edu cs106
    138.234.44.107  cs107.cs.gettysburg.edu cs107
    138.234.44.108  cs108.cs.gettysburg.edu cs108
    138.234.44.109  cs109.cs.gettysburg.edu cs109
    138.234.44.110  cs110.cs.gettysburg.edu cs110
    138.234.44.111  cs111.cs.gettysburg.edu cs111
    138.234.44.112  cs112.cs.gettysburg.edu cs112
    138.234.44.113  cs113.cs.gettysburg.edu cs113
    138.234.44.114  cs114.cs.gettysburg.edu cs114
    138.234.44.115  cs115.cs.gettysburg.edu cs115
    138.234.44.116  cs116.cs.gettysburg.edu cs116
    138.234.44.117  cs117.cs.gettysburg.edu cs117
    138.234.44.118  cs118.cs.gettysburg.edu cs118
    138.234.44.119  cs119.cs.gettysburg.edu cs119
    138.234.44.120  cs120.cs.gettysburg.edu cs120
    138.234.44.121  cs121.cs.gettysburg.edu cs121
    138.234.44.122  cs122.cs.gettysburg.edu cs122
    138.234.44.123  cs123.cs.gettysburg.edu cs123
    138.234.44.124  cs124.cs.gettysburg.edu cs124
    138.234.44.125  cs125.cs.gettysburg.edu cs125
    	
  5. Use control-o to save the changes you made, and control-x to exit.

4. File Transfer via CyberDuck

  1. Download CyberDuck from https://cyberduck.io/download/. It is free (and legal) here, but also available for purchase from the App store.
  2. Open the download and follow its instructions to install.
  3. Run CyberDuck, and click the "Open Connection Button"
  4. Change the top drop down box to: "SFTP (SSH File Transfer Protocol)".
  5. Enter the name of the workstation to which you would like to connect (e.g. cs101.cs.gettysburg.edu). If you changed your /etc/hosts file in the previous section you can type cs101.
  6. Set the port to 222.
  7. Enter your CS user name and your CS password.
  8. Click "Connect".

You can now drag and drop files to and from this window to transfer them between your computer and the cs workstations. Notice that transferring your files into your account on a workstation actually puts it on our file server, so you will have the same files on all of the workstations.

You can also use the terminal for file transfer. Running the program sftp will give you an interactive shell for transfering files. Running the program scp will allow you to copy files from systems similar to how cp works locally. The details are beyond the scope of this page.

5. Access to your H drive

If you need to transfer files to or from your H-drive you can use CyberDuck as well.
  1. Open CyberDuck.
  2. Click the "Open Connection" button.
  3. Change the top drop down box to: "SFTP (SSH File Transfer Protocol)".
  4. For the server name enter: ftp.gettysburg.edu.
  5. Set the port to 222.
  6. Enter your College user name and your College password.
  7. Click "Connect".

6. Errors running JavaFX programs vis ssh.

If JavaFX programs don't run, but produce an error such as:
      X Error of failed request: BadValue (integer parameter out of range for operation)
      Major opcode of failed request: 149 (GLX)
      Minor opcode of failed request: 24 (X_GLXCreateNewContext)
      Value in failed request: 0x0
      Serial number of failed request: 30
      Current serial number in output stream: 31
    
  1. Open up a new terminal (do not ssh).
  2. Type the following command:
    	  write org.xquartz.X11 enable_iglx -bool true
    	
  3. Quit xQuartz.
  4. ssh to a workstation and try running it again.