Working Remotely on the Mac
1. Direct SSH Connection
- Open up a terminal window. To do so, got to Applications->Utilities->Terminal.
- 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
- 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:
- From the Apple Menu, open System Preferences...
- Click on "Security and Privacy" and open the "General" tab.
- Click the Lock at the bottom left corner of your screen, and enter your password.
- Select "App Store and identified developers" under "Allow apps downloaded from:"
- Download the program XQuartz from https://www.xquartz.org/. It will download a .dmg file; open it.
- Double click on XQuartz.pkg and follow the instructions. Note there is no longer an X11.app that this is replacing.
- 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.
- 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
- 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
- Edit the file config using the editor pico.
pico config
- 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
- 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.
- It will prompt you for a file name which should already be config. Hit enter.
- Type control-x to exit pico.
Configure your /etc/hosts files
The following steps will let you simplify the ssh command to ssh cs1
- Open a terminal, and change to the computer's /etc direcotry.
cd /etc
- 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
- 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
- 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
- Use control-o to save the changes you made, and control-x to exit.
4. File Transfer via CyberDuck
- Download CyberDuck from https://cyberduck.io/download/. It is free (and legal) here, but also available for purchase from the App store.
- Open the download and follow its instructions to install.
- Run CyberDuck, and click the "Open Connection Button"
- Change the top drop down box to: "SFTP (SSH File Transfer Protocol)".
- 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.
- Set the port to 222.
- Enter your CS user name and your CS password.
- 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.
- Open CyberDuck.
- Click the "Open Connection" button.
- Change the top drop down box to: "SFTP (SSH File Transfer Protocol)".
- For the server name enter: ftp.gettysburg.edu.
- Set the port to 222.
- Enter your College user name and your College password.
- 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
- Open up a new terminal (do not ssh).
- Type the following command:
write org.xquartz.X11 enable_iglx -bool true
- Quit xQuartz.
- ssh to a workstation and try running it again.