REMOTE ACCESS TO PBIC FROM macOS

(all versions including 2020’s BigSur)

 

(For MAY 2021 CONNECTION ISSUES at Screen Sharing Stage please see trouble shooting below)     

 

The pre-installed utilities Terminal and Screen Sharing will be used to set up and to display the remote PBIC session.  You can find these using Spotlight (click the Spotlight icon in the upper-right corner of the menu bar, or press Command-Space bar and type their names).  Once they have been launched consider adding them to your Dock (right click on the active app icon, Options, Keep in Dock).

Using Terminal to start a vncserver session

Enter the following at the command prompt in the terminal window, with username being your University ADF user name e.g. username@pbic.bham.ac.uk (use this format without ‘.’ in the username, rather than say d.s.fraser. This is called the ‘short name’.)

ssh username@pbic.bham.ac.uk

Enter your University ADF password when prompted.

Once successfully connected through ssh you will be able to create a VNC session with the following command (but don’t yet!):

vncserver

You may want to override the default desktop size (the default is 1024x768) to match your local screen size. If, for example, you wanted a larger screen size of 1280x1024, amend the command as follows:

vncserver -geometry 1280x1024

You may want also want to override the default colour depth (16 bits) to be 24 bit color:

vncserver -depth 24

Or you may want to do both at the same time:

vncserver -geometry 1280x1024 -depth 24

If you have never run the vncserver before you will be prompted twice to set a password. To avoid later confusion it would be sensible to make this password the same as your regular University ADF login password.

When you run the vncserver command it will show the display name and number of the VNC session in the form:

pbic.bham.ac.uk:XX

where XX is a one or two digit number. This is the display number of the virtual desktop.

Make a note of the XX number - it is your unique VNC session identifier. When typing it in to the following commands zero pad it to two digits. So 8 -> 08, whilst 22 remains 22.

 

You may now type "exit" to close this SSH session (or click "x" button on top right of window to close the Terminal window). The remote vncserver session you have started will stay running. So long as the remote computer pbic.bham.ac.uk is not rebooted, this virtual session will continue to run until you choose to kill it.

If you want to kill the session, say to create it with a different geometry:

vncserver -kill :XX

NB Note that you should only run the vncserver command once, the first time you connect to pbic.bham.ac.uk. Only if the vncserver session crashes or if the PBIC Cluster is rebooted should you run this command again. If you do already have a vncserver session running, do not try and run another server session. You should get a warning telling you that you already have a session running (and telling you which session number it is).

Connecting to your VNC session on PBIC

With the vncserver set up you still need to connect to it.  The following will need to be undertaken each time you connect to pbic.bham.ac.uk.

Open (another) Terminal window and enter the following at the command prompt, with username being your University ADF user name and XX your VNC server session number on PBIC:

ssh -L59XX:localhost:59XX username@pbic.bham.ac.uk

Enter your University ADF password when prompted, and you should see a Last Login.

Leave the above terminal running and open the MacOS inbuilt Screen Sharing app. The following window will appear:

Enter the following for the entry Host:

localhost:59XX

Enter your VNC password and click on connect, you should now have an open VNC session on PBIC.  This will appear as a window with the ‘geometry’ sized window as determined above.

Troubleshooting

If this fails, you may need to alter some settings in the Sharing pane of Settings.  Specifically, you will require Screen Sharing to be active.  If you are already using another Remote Management client, you will not be able to tick Screen Sharing without first disabling Remote Management.

 

If this fails to remedy the situation it is possible you still have a previous SSH tunnel still open.  Restarting your Mac will clear all active local sessions (but not kill the remote PBIC session!) and allow you to use Screen Sharing once more.

Finishing a VNC session - Shutting down the VNC server

Should you not need to keep the session alive then you should stop your vncserver to free up resources for other users. This can be done by using a Terminal window to connect to pbic.bham.ac.uk as above and then typing:

vncserver -kill :XX

where XX is your display number.

 

Useful VNC commands

 

vncserver -geometry 1280x1024

Start vncserver with specified display size

vncserver -depth x24

Start vncserver with specified screen colour depth

vncserver :xx

Start specified vncserver session number

vncserver -kill :xx

End specified session number

vncpasswd

Change vncserver password

vncwho

 

 

File Transfer – Remote PBIC <-> Local Mac

Under Windows you can use the WinSCP client to perform file transfers using the GUI.  On the Mac you can use the command line interface in terminal, using the scp  command to copy between your local Mac and remote PBIC.

The command you use for this is scp (secure copy).  it uses this basic syntax scp -flags source destination

Example –

Navigate to a folder of interest in Terminal on either the Mac or on PBIC.

To demonstrate file copying in terminal we will make an example file, like so;

 echo "Hello CHBH" > hello.txt

 This creates a simple txt file.  Then execute; 

 ls

 Check the file exists in the ensuing listing.

 To copy from local Mac to the remote PBIC execute this command in the terminal

 

scp -r hello.txt username@pbic.bham.ac.uk:/home/people/username/Desktop/ExampleData

This has the syntax scp -flags source destination.

The source is the local file we just made… hello.txt and the destination is my login @ PBIC and then an existing folder on PBIC.

If that command fails then it is likely the destination is not well described. If it works then so should this which will do a folder called ExampleFolder from local Mac to remote PBIC

scp -r ~/Desktop/ExampleFolder username@pbic.bham.ac.uk:/home/people/username/Desktop/ExampleFolder

To go from PBIC remote to Mac local we just reverse source and destination

scp -r username@pbic.bham.ac.uk:/home/people/username/Desktop/ExampleFolder /Users/username/Desktop/ExampleFolder

Notice that the remote to local has the full path on the Mac /Users/username/Desktop/ExampleFolder.. replace username with you actual local username on the Mac

GUI Based File Transfer

You can use the FileZilla (https://filezilla-project.org/) to copy files using a Graphical User Interface

Note that this may terminate any SSH sessions you have open in the Mac Terminal.

You can use the following details for Quickconnect

Host: sftp://pbic.bham.ac.uk

Username: your university ‘short name’ e.g. username 

Password:  your VNC password (not necessarily the same as your ADF password)

 

 

Troubleshooting

MAY 2021 CONNECTION ISSUES  – some user report successfully connecting, but that the macOS inbuilt Screen Sharing App’s session fails to respond after appearing to show the remote desktop.  Currently this issue affects Mojave, Catalina and Big Sur intermittently and without known cause.  We have tested the free RealVNC and this appears to work as a full replacement – connect to localhost:59XX – as with the inbuilt app. A secondary fallback for this is connecting via a PC.

 

Should your Ventura Mac give the error "no matching host key type found. Their offer: ssh-rsa,ssh-dss"

Mac users who have Ventura will be unable to connect to the Cluster.
To restore connection they will need to modify (or create) their ~/.ssh/config file to appear like this;
 
Host *
HostkeyAlgorithms +ssh-rsa,ssh-dss
PubkeyAcceptedAlgorithms +ssh-rsa,ssh-dss
 
Or just add the last two lines under Host * if their file already exists.