After setting up an SSH connection between my laptop as host and desktop as client (both running LM 18.3) the host IP address is listed in the client file system under Network. I created links to folders by dragging them to the Bookmark area in the left hand pane. In order to automate the connection on startup I created the following script:

#!/bin/bash
ssh <myname>@192.168.1.4

saved it as Serverconnect, made it executable by running chmod +x Serverconnect and added it as a Custom command in Startup Applications. On restarting the client the server IP address is not listed in the file system and the folder bookmark folder icons now have what looks like a miniature browser icon imposed upon them. However, as soon as I click on any one of these Bookmarked folders the folder opens, the browser mini-icons disappear and the server IP address appears under Network.

To complete the connection without this manual intervention (so I can add further commands) I think I need to add a mount command to Serverconnect but nothing I have tried so far works. Please can anyone tell me how to get my automated server connection fully mounted on startup?

Last edited by Guifan on Sat Mar 03, 2018 1:33 pm, edited 1 time in total.

Your script will not allow you to access the server via the file manager because you are connecting to the server via the shell. You are in a live connection to the server and there is no mount point so there is nothing for the file manager to access. A gvfs-mount will create a mount point.

If the problem is this: On restarting the client the server IP address is not listed in the file system then perhaps you didn't select "Remember Forever" when you passed credentials the first time through the file manager.

If you didn't do that or if you don't want to do that then create a file in your home directory - for example at /home/tester/.ssh/sshpasswd - containing one line - the password to the server.

Thanks, Altair, I used SSH key based authentication to avoid any issues with passwords. I found that once a connection was established, it was preserved when logging out and in again but lost when re-starting. However I have found a fix based upon: https://www.tecmint.com/sshfs-mount-rem ... using-ssh/
I installed SSHFS, created a new directory (sudo mkdir /mnt/server), created a new group 'fuse' to which I added my username and then edited /etc/fstab to add the following line:
sshfs#<myname>@192.168.1.4:/home/<myname>/DATA/ /mnt/server fuse.sshfs IdentityFile=~/.ssh/id_rsa defaults 0 0
On testing I found that gvfs-mount sftp://<myname>@192.168.1.4 was still required as a Startup command.
With these changes the server files are always accessible on the client machine without the need for any manual actions, even if both machines are turned completely off and on again. I don't understand how this works but I hope it will be a stable solution.