2

Iv'e managed to get my ssh volumes mounted with SSHFS via the command line but would really like is to have them auto mount on login. So far, I've set up a launchAgent to run a shell script that contains the commands I would use in the terminal. That contains:

mkdir /Volumes/mysshfsvolume
sshfs blah blah blah

This works via the terminal but when the launchAgent loads, It seems momentarily mount the volumes and then they disappear.

I have seen other older solutions that include editing the /etc/fstab, AppleSrcipt and automator but I am looking for a Mavericks related solution. I have actually found a way around it using ControlPlane but just wondering if anybody has more extensive knowledge of how automount works on Mavericks. TIA.

Just to add some information, I'm not too familiar with the systems that I'm logging into but one is a SUN Solaris and the other is a RHE linux server.

I also tried just adding the script to my login items and it works for the linux connection but not the SUN server.

2 Answers 2

1

I have using Homebrew and its sshfs bundle to mount SSH filesystems on my Mavericks Mac for a while now, it has been solid.

So if you run Homebrew go ahead and try the following to install sshfs: brew install sshfs. Then maybe reboot (?) and once you're back sshfs <username>@<hostname/IP>:<remote-path> <local-path>. You will get a password prompt at this point if you're using that kind of authentication. If you're using SSH keys then probably no prompt.

Update: maybe you should modify your bash script to use nohup. it sounds almost like the process dies after it runs your bash script. checkout nohup on wiki or man nohup.

2
  • 1
    Hi, I already have SSHFS installed. I should note that I installed it via sourceforge.net/projects/fuse/files/sshfs-fuse not home-brew. I'm not sure if it makes any difference though. I am using ssh keys. The volumes mount successfully if I manually enter the command in the terminal but not when I run the launch agent that points to a bash script that I have created. As stated in the question, the volumes momentarily mount and then disappear. Commented Apr 28, 2014 at 4:55
  • Re nohup yeah you seem to be on the right track in the sense that it seems like the process just dies. I'll check it out and give it a try when I have the time. Commented May 5, 2014 at 14:00
0

Make sure you set up SSH keys with both servers you're trying to connect to. Once you've done this, you can create a simple shell script to connect to your server. Something like this should do:

#!/bin/bash
mkdir /Volumes/mysshfsvolume
sshfs blah blah blah

Once you've got your shell script set up, you can set it up to run at login by using plist files. plist files for Mac are like supercharged cron jobs. You can set them up to run at specific intervals, run at system boot, or run when a certain user logs in. In your case, you would want it to run every time you log in. You can glean some more info from this Stack question:

https://stackoverflow.com/questions/1370901/very-simple-launchd-plist-not-running-my-script

(just a side note)

If you happen to use a server host like Digital Ocean which provides an API, you can get even fancier with your script and use the API to automatically find every server on your account, and auto mount each one at login. I had a neat script set up that SSHFS'd all of my servers on my DO account, and even picked up new ones when they were added.

4
  • This doesn't really help. I already know about the suggestions you have made. Commented May 5, 2014 at 14:03
  • You asked how to auto mount at login. This is a pretty much a step by step guide. Did I miss part of your question, or did you not read my entire answer? Commented May 6, 2014 at 0:14
  • I already have a bash script written and have made a LaunchAgent to run that script. I have also set up the keys. When I execute the script from the terminal, it works as expected. But when I execute it using the LaunchAgent, the volumes appear for a second and then just disappear immediately after that. Commented May 11, 2014 at 7:00
  • Can you update your question to include to contents of the plist file? Commented May 12, 2014 at 14:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .