Forum Moderators: bakedjake

Message Too Old, No Replies

Remote access via SSH

Automatic connection on boot

         

dstiles

9:09 am on Aug 18, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have a local network of linux machines plus one remote mail server. I have had an SSH password-less access to the remote server for years, but I'm trying to tidy up my local network and one of the items is a long-established niggle when rebooting the local machines.

I would like the remote access SSH (call it "myremote") to be automatically established when booting a local machine. To do this I want to add a line in fstab.

In a file manager (Thunar) I can simply type sftp://myremote and it's mounted.

In terminal I can use...
sshfs -p 1234 -o allow_other,IdentityFile=~/.ssh/id_rsa servername@123.123.123.123:/ /mnt/myremote


In fstab I cannot get it to work. Something like...
servername@123.123.123.123:/ /mnt/myremote fuse.sshfs sshfs_debug,debug,-p=1234,fsname=MyRemote,IdentityFile=/home/dave/.ssh/id_rsa,x-systemd.automount,users,allow_other,reconnect,_netdev 0 0


...returns, on sudo mount -a...
SSHFS version 3.7.0
executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-oPort==1234> <-oIdentityFile=/home/dave/.ssh/id_rsa> <-2> <servername@123.123.123.123> <-s> <sftp>
command-line line 0: Missing argument.
read: Connection reset by peer


I cannot discover which argument is missing, nor from where (mount or ssh).

Another aim was to use the long-established SSH config file and simply call it as myremote but that seems a long-shot.

Anyone have any ideas, please?

brotherhood of LAN

9:21 am on Aug 18, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Can't see anything obvious wrong, though you could also try using @reboot via cron to achieve the same thing on booting up

dstiles

1:51 pm on Aug 18, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hmm. It's a thought. I need it running before thunar etc auto-loads. I suppose I could try from the Session Start system but I'm not sure when the auto-load happens.

dstiles

9:57 am on Aug 20, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I fixed the error by adding noauto into the options after finding yet another "use this line". Sadly, it still does not mount. The implication now is that the connection is attempted but I cannot get it to show why. I've added sshfs_debug and -v but nothing. Maybe I'll give up on this. :(

Jonesy

4:08 pm on Aug 22, 2020 (gmt 0)

10+ Year Member Top Contributors Of The Month



I've had issues "on boot" where the network is not yet ready for prime time.
Try testing with a 30 or 60 second delay ahead of your ssh in the script.

dstiles

8:28 am on Aug 23, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Good suggestion but this is with mount -a not boot.