Connect to remote storage using SSHFS as if it was a network drive, and we'll show you how to connect your Mac using it. SSHFS is one of those features you wish was built directly into your Mac and with ExpanDrive now it is. ExpanDrive adds SFTP support directly into Finder and every other application on your Mac.
Mac OS X: use SSHFS to mount a remote directory as a volume Posted on December 26, 2012 November 10, 2014 by hb While working for amazingweb, I often need to edit existing files. There is only one user on this Mac (me) and that's all there'll ever be. But I still wanna keep it clean, system-wide. I really dislike the idea of user-wide settings when it comes to this. That's why I wanna find a proper solution. Otherwise I could just run this script I wrote in the OP every time I log on and be done with it. From the Wikipedia: SSHFS (Secure SHell FileSystem) is a file system for Linux (and other operating systems with a FUSE implementation, such as Mac OS X or FreeBSD) capable of operating on files on a remote computer using just a secure shell login on the remote computer. Download and install the SSHFS module (available from the FUSE for OS X page). As with managing Ext2 and Ext3 drives, create a folder on your Mac to use as a mount point.
Today we present part 5 in our series of posts examining some of the various and interesting ways that you can connect your classic Macintosh with other computers on your network. The topic of the day is networking your Mac to Linux using sshfs to connect from the Linux system to the Mac.
Networking is a complex and endlessly variable topic, but even so, we near the end of this series at last – there is only one post after this one.
By this point in the series, curious readers are probably beginning to wonder why the iconic Linux penguin has graced the opening image of every one of these posts without ever being mentioned. Well, today we will finally address Tux’s reason for being one of the marquees of this series. For those of you who are not Linux literate, “Tux” is the name generally given to the beloved Linux mascot, the penguin.
The long and the short of it is that Tux is there because I needed him. Back in 2004, having grown tired of all the viruses, anti-viruses, malware, security updates and the constant state of computational danger associated with using Windows, I made a dramatic move, chucked the whole thing out and moved to Linux. Instant virus/malware/security relief ensued, and I became a very happy Linux camper for two years. There was just one lingering problem. There was a critical program that had no Linux peer, and that I used constantly – Photoshop.
Apple Mac Os Sierra Download
Back in 2004, GIMP simply wasn’t good enough to replace Photoshop, especially for those of us keen on absolute fidelity in color reproduction. That single unfortunate fact forced me to keep Windows around for the sole purpose of running Photoshop. And so it was until 2006. By then, the 3.0 MHz Pentium IV box that I was using as my prime Photoshop engine was definitely starting to feel a bit long in the tooth. With so much new and faster technology available at that point, it was clearly time to consider upgrading to a better machine.
For the first time ever, I gave serious consideration to getting a Macintosh. The Power Mac G5 had caught my imagination. The G5s were supposed to run Photoshop up to 150% faster than anything else could, and a Mac would allow me to retire Windows entirely and have just one computer that could do it all. The “halo effect” from the absolutely fabulous iPod I had acquired that same year helped push me over the edge, and in mid-2006, I purchased my first personal Mac, a dual core, 2.3 GHz Power Mac G5 running Mac OS X 10.4 Tiger. It was odd stepping “up” to a 2.3 GHz machine from a higher clock rate 3.0 GHz machine, but as Apple so eloquently reminded us in their descriptions of “the megahertz myth”, all GHz are not created equal. Despite the nominally lower clock speed, in real world practical use the G5 was about 150% faster than the machine it replaced.
Being a diehard Linux user of two years by then, I had Linux on several computers in the house and the first thing I wanted to do with my new Mac was to network it to those existing Linux boxes. To say that this was a challenge would be the champion of understatements.
The wisdom of the day held that the use of Microsoft’s SMB protocol (which we looked at in the first two installments of this series) was the best and most universal approach. This may have been the case, but ease of use and ease of configuration have never been Linux strong points, and this was particularly true for SMB. Anyone who has ever struggled to get Samba (the Linux implementation of SMB) running on Linux will appreciate the truth of what I am saying. I have ten dense pages of notes in my log book from that time, documenting my tortuous, if ultimately successful, quest to get SMB running from Linux to my new Mac.
Thinking that there had to be a better way, I experimented with NFS, with similar results. The bewildering complexity involved on the Linux side contrasted sharply with the ease of setup and use on the Mac.
There HAD to be an easier way, and I finally unearthed it in an application called sshfs, the SSH File System. Linux fans will recognize this as a FUSE-based Linux capability that provides a user space remote file system by leveraging SSH for fundamental connectivity. Even on Linux, sshfs has the singular attribute of being remarkably easy to use. sshfs is as easy to run on the Linux side as it is to set up on the Mac side… and the Mac side could not get much easier. On the Mac side, just go to the Sharing control panel and check the “Remote Login” checkbox. Mac OS X has an embedded SSH server which is started when this box is checked. The Linux side is equivalently simple: run a single shell command and you are off and networking.
Now Linux is a many-splendored thing, and the steps required to get sshfs installed and operational on any one distribution can often be wildly different from the steps required to accomplish the same thing on any other distribution. With this in mind, and noting that it is beyond the scope of this Macintosh-focused blog to go into the specifics of Linux software installation anyway, I won’t go into the gory details of how I got sshfs up and running. In general however, let me say that it can often often be as simple as starting the distribution’s package manager, selecting the sshfs package, and installing it. It can then be run directly from the command line, or configured as a permanent startup item.
In my case, I installed the Linux on the machine I used for this testing way back in 2007, shortly after I built the machine. The machine in question is the well-storied 200 MHz Pentium Pro box that has figured so often in tales told in past posts of this blog. In addition to the Windows NT 4.0 that has been mentioned so any times, it also runs Arch Linux Duke 2007, in a dual boot setup. I installed sshfs at the time I installed Arch Linux, and it has been there ever since.
I love using sshfs for Linux file sharing because it is just so darn easy to use. There is no firewall configuration, no /etc/hosts alterations, no name resolution issues to work through… nothing. Just start it and it works! Here is what starting sshfs to my Power Mac G5 looks like under Arch Linux on the above Pentium Pro system:
Dissecting the above shell command, it tells sshfs that my Power Mac G5 has local address 192.168.0.21, my userid on it is “mac57” and that it should be mounted on mount point /mnt/g5. That is it, that is all! One simple command, and even one that is largely absent the arcane syntax of so many Linux commands. As you may be able to see, I have embedded even this fairly simple command into a script called “mount-g5” to make it even SIMPLER to use.
This command prompted me for my login password (after all, this is SECURE Shell!) and then connected me straight away. My Power Mac G5 was now accessible like any other folder on the system, available as /mnt/g5.
For Linux power users, I issued the “mount” command and captured its output, so that you could see the particulars of the mount involved. The screen shot appears below:
At this point, I could browse the G5 remotely from my Linux system using any file manager of my choosing. Since my Pentium Pro system is not a computing heavyweight, even at 200 MHz, I have loaded it with the lightweight combination of XFCe and Rox Desktop, delivering fairly good performance even in a low powered environment. Hence, I browsed the G5 using Rox Filer and the result looked like this:
I could both read and write files. In fact, all of the screen shots presented in this post were taken with GIMP on the Pentium Pro Linux system and then transferred to the G5 using simple drag ‘n drop via Rox Filer.
Thanks to this simple to use and convenient application, networking between Linux and your Mac OS X system need not be too strenuous. I would love to be able to use this same approach to network Linux to Mac OS Classic as well, but I have never been able to find an SSH server for Mac OS Classic. If you should be aware of one, please leave a comment and let us all know!
Closing Thoughts
That wraps up this post. In this second last post of the series, we have examined the use of sshfs as a file sharing mechanism between Linux and Mac OS X, adding to our earlier examinations of SMB, FTP and HTTP as file sharing enablers. In the upcoming final post of this series, we will put all of the preceding file sharing methodologies together into the grand slam of networking. Stay tuned for the big finish! Until then, happy networking, no matter how you choose to do it!
I recently go a new Mac and I wanted to setup autofs on it, just like I did on my previous Linux Laptops. I am running Mac OS X Mountain Lion (10.8):
AutoFS
There are pretty good definitions of AutoFS (and it’s components) on Mac OS from the various man pages:
Autofs in Leopard consists of the following programs and daemons.
autofsd
autofsd runs automount, and then waits for network configuration change events and, when such an event occurs, re-runs automount to update the mounts to reflect the current automounter maps. It can also be signalled by automount_reread to run automount.
automountd
automountd is a daemon that responds to requests from autofs to mount and unmount network filesystems, and to supply the contents of directories, based on the contents of automounter maps. The automountd is started on demand by launchd.
automount
automount is the actual mount manager. Manages the mounting and unmounting of remote resources using several map files and configuration files. The configuration files used are /etc/autofs.conf and /etc/auto_master.
automount_reread
The man pages for autofsd refer to a command called automount_reread that can trigger a network change event for autofs. However, there is no additional documentation in Leopard on that command and the command itself does not exist.
We can see that by default only autofsd is running:
We can also check out if the daemons are started via launchd:
Lastly we can see what state the daemons are in:
The D stands for on-demand.
Autofs Maps
With Mac OS there are a couple of options for autofs. From the Mac OS man page:
Direct MapA direct map associates filesystem locations directly with directories. The entry key is the full path name of a directory. For example:
Since the direct map as a whole isn’t associated with a single directory, it is specified in the master map with a dummy directory name of /-.
Indirect MapAn indirect map is used where a large number of entries are to be associated with a single directory. Each map entry key is the simple name of a directory entry. A good example of this is the auto_home map which determines the entries under the /home directory. For example:
I prefer to have everything that is managed by autofs in one directory, so I will go with the Indirect Map approach.
Creating an Indirect Map for AutoFS
I will use /amnt as the mount point which autofs will manage. To set this up, edit the /etc/auto_master file and add the following to it:
The above basically says that anything under the /amnt directory will be configured under the /etc/autofs_amnt file. Next let’s add a CIFS share to be automatically mounted /amnt/smb.
Auto Mount SMB with Autofs
Let’s create the /etc/autofs_amnt file with appropriate permissions:
Now let’s edit the file and add the following to it:
Now to apply the settings run the following:
notice /amnt is now included. If everything worked you can cd into the directory and it will automatically mount:
![For For](/uploads/1/1/9/5/119550746/764668893.png)
You can use the mount command to find out the options of the mount point:
You will also notice automountd now running as well:
If you ever want to manually un-mount the share, run the following:
Auto Mount NFS with Autofs
Edit the /etc/autofs_amnt file and add the following:
Apply the settings with:
and check to make sure it is auto mounted:
and of course mount can show you the options:
Mount SSHFS with Autofs
The first thing that we need to do is install Mac Ports.
Install Mac Ports
Go to Installing MacPorts and download the pkg installer. Launch installer and you will see the following:
Follow the on-screen instructions install Mac Ports.
Install X-Code
X-Code is necessary for Mac Ports, so go ahead and install it from XCode. It will actually start up the App Store to do the download. After it’s done your App Store will look like this:
Install X-Code Command Line tools:
Go to your Applications (Command-Shift-a) and launch X-Code (accept the license agreement). Then go to the preferences:
Then go to the “Downloads” tab and install command line tools. After they are installed you will see the following under preferences:
Update Ports
Go to your “Utilities” (Command-Shift-u) and launch the terminal. From the terminal run the following:
Now your ports are all up-to-date. You will also notice that that the Mac Ports install added the following into your .profile file:
Since Mac Ports installs everything under /opt/local it needs to add /opt/local/bin/ and /opt/local/sbin/ to the path.
Install SSHFS
Mac Ports are like any package manager, it allows you to search for packages and install them. For example here is what I did to search for sshfs:
I don’t care about the GUI version. You can also check if the package has “variants”:
Sshfs For Mac Os Recovery Tool
There aren’t that many options. A good example is something like this:
So if I wanted to enable debug binaries for the mysql56 package I would run the following:
Anyways, to install sshfs, run the following:
Prepare SSHFS for Autofs
First make sure you can mount with the sshfs command:
Now for the actual mount:
You can un-mount the sshfs mount point like this:
The way that autofs works is the type of the file system is always prepended with the mount_ prefix and that is run to actually mount that file system. So if you specify smbfs, there must be a mount_smbfs command. Here are the available mount commands on the system:
So we need to create a mount_sshfs command. We can just create a symlink to the sshfs command like so:
Now let’s edit the /etc/autofs_amnt file and add the following:
As always, refresh automount by running the following:
Now check to make sure autofs works:
That looks good, you can check the command that was executed by autofs to mount the sshfs mountpoint:
If it fails for some reason, grab that command and try to mount it manually to track down any issues. If you have any mount points that are stuck, try to restart both the autofsd and automountd daemons:
autofsd is automatically restart by launchd, so you can just stop it, and it will restart it. Automountd is started by autofsd so you can just stop that as well, and as soon as you try to auto mount something, it will automatically start up. If you want to get a feeling of all the file systems that are mounted you can run the following: