The MacValley blog
Welcome to the MacValley blog, your first stop for all the latest MacValley news and views.
The MacValley blog
Editor: Tom Briant
Sunday, March 5, 2017
I’m sure when you set out to network your Ubuntu Linux machine, or any other Linux machine for that matter, over to your Mac...you ran into difficulties.
First off, you followed the instructions for sharing from a Ubuntu Linux machine. It’s simple.
You right-clicked on the folder you wish to share and click on “Share This Folder” From there, you just followed the steps as laid out for you by your Linux distro. Simple and straightforward.
Then you went back to your Mac and looked on the Finder’s Sidebar for shared devices. You found your shared folders. You double-clicked on them. Up popped a dialog box. So far, so good.
You entered your Linux user name and your Linux password. Over and over again. This got old real fast.
What is wrong here? I’ll tell you what’s wrong. How Linux uses the SAMBA SMB networking protocol differs markedly from how macOS 10.12.3 uses the SMB networking protocol. They are totally incompatible. You’ll end up tearing out what little hair you have left over this.
So relax, have a refreshing beverage, and continue to read. I’m going to show you how to network your Linux machine, in this case stock Ubuntu 16.04, with my Mac Mini running macOS 10.12.3.
THE GUIDING PRINCIPLE HERE IS TO FORGET ABOUT SMB AND GO WITH SSH AND SFTP AND AFP.
I have found two ways to network a Ubuntu Linux machine to a Mac. One takes five minutes, but requires a little terminal work in Linux.
The second one takes more terminal work in Linux, plus the installation of a 3rd party SSH/SFTP browser called Filezilla on your Mac
You’ll have to edit one file in all this, but it’s one line and it’s pretty easy.
NETATALK SHARES YOUR HOME DIRECTORY WITH MACOS.
Here’s how to do it:
First, on your Ubuntu desktop (I’m assuming Ubuntu for this. If it’s a derivatives of Ubuntu, such as Kubuntu with the KDE GUI, just start the Konsole terminal from the Launcher menu), ahem, PRESS THE CONTROL + ALT + T keys.
Up pops your Terminal
Enter this line into the Terminal. Copy and paste it if you want to:
sudo apt-get install netatalk
After entering that line, press the ENTER key
The terminal will ask you for your password. This may be the hardest part, because you have to type in your password with no visual feedback.
Nothing shows on screen to help you.
Now press the ENTER key. If you succeeded, the download and installation process will begin.
If not, well, try again and type slowly and mindfully. Then press the ENTER key.
Assuming you’ve succeeded, the download and installation of Netatalk begins. At some point, you’ll get asked whether to proceed. Just press the Y key and the ENTER key.
When it’s done, you’ll return to the Terminal prompt.
Now for the file editing. Type or copy and paste the following into the Terminal at the prompt:
sudo nano /etc/netatalk/atalkd.conf
Press the ENTER key. Enter your password if asked.
You now see the nano editing screen with atalkd.conf ready to edit.
Scroll down to the very bottom of the file by pressing and holding the Down arrow.
At the bottom of the file add these four characters:
That’s an “e”, a “t”, an “h”, and a zero. Not the letter o.
To save, or write out, this modified file, press the Control key and the letter O.
You will get a highlighted message showing the file’s name and the file path or where’s it’s located in the file system.
Go ahead and press the ENTER key to save, or write out, the file to disk. You’ve saved 38 lines.
Now press the Control and X keys to exit the nano editor. You’ve returned to the terminal prompt.
Your work on the Ubuntu Linux machine is done for now. Move back to the Mac.
Open the Finder. Look at the Sidebar under Shared. You want a computer icon with the name of your Linux machine under it.
Don’t see it? Restart the Linux box. Give it a kick in the pants to get its attention.
Now you should see it. My shared directory is called Lamont, after Lamont Cranston, The Shadow. Super-hero of 1940’s radio. But I digress...
Anyway, that’s the quick way to set up a two-way network with Ubuntu as the server and your Mac as the client. Just treat the HOME directory as another Mac folder to drag files to and from.
If the reboot of the Ubuntu Linux machine didn’t work, check to make sure all the Ethernet cables are firmly in place. Pull them out and push them back in until you hear and feel a click.
Now you’ve shared your Linux HOME directory as an Apple Filing Protocol network drive. Until further notice, this works just fine. But read on for a warning about the future.
The future-proof way to network your Ubuntu Linux machine back to your Mac
This reverses the process I showed you in Part I, where you set up your Mac as an SSH/SFTP server and your Ubuntu Linux machine as the client.
Step One: Ubuntu Linux doesn’t come with an SSH/SFTP server installed. You have to install it. But it’s relatively simple.
Go back to the Ubuntu Linux machine and start the Terminal by pressing Control+Alt+ T or going under the Applications Menu for the Terminal.
What matters is that you start the Terminal.
Now to install the SSH server, known as OpenSSH, via the Terminal. You type, or copy and paste, this one line, into the Terminal:
sudo apt-get install ssh
Press the Enter key.
Enter your Linux password carefully and mindfully to ensure no errors. Press the ENTER key and the installation should begin.
Watch the text scroll down the screen and then return to the prompt.
How do I know I succeeded before I add any more software?
Well the Finder can’t work with SFTP and SSH connections, but your Terminal can.
So open the Terminal to enter this command:
ssh <Linux user name>@<Linux computer name or URL>
Press the ENTER key. Enter your Ubuntu Linux password carefully and mindfully to avoid mistakes.
Now you’ll get asked if you want to trust the Linux computer. If it’s sitting right next to you, of course you do. So type yes and press the ENTER key.
You will get a warning that you’ve made friends with this computer for better or worse now.
Finally enter the Linux password one more time. Now you’re sitting virtually in front of your Linux computer from your Mac. It’s quite possible you could do this with a Linux computer much farther away!
By the way, the URL refers to the Linux computer’s Internet address of xxx.xxx.x.x.
But CONGRATULATIONS! YOU’VE LOGGED INTO YOUR UBUNTU LINUX MACHINE FROM YOUR MAC USING SSH! WOO-HOO!
But I doubt that you want to enter a complicated command line just to copy or move a folder from your Linux compute to your Mac or the other way. No, you want a file manager that recognizes SSH and SFTP connections. And Finder just won’t cut it.
Now you may already own a suitable browser. Do you own the Forklift file manager or the Commander One Pro file manager? They’ll do it.
If not, go here to the Filezilla Web site to download the donationware Filezilla SSH/SFTP browser. it works with macOS 10.7 and up.
You will run an installer to set it up. Beware of bundled crapware. They are a non-profit and have to pay the bills somehow. So they agree to bundle software with it that you have the chance to forgo. So be careful. It’s not destructive malware, but you don’t need the Yahoo Search Engine replacing what you already use in your browser.
So start up the Filezilla browser. I’ll explain it to you.
You need to enter the connection information first.
The host is the Ubuntu Linux computer’s name or its Web address.
The username is your Linux user’s name.
Your password is your Linux password.
The port for SSH and SFTP connections is port 22.
The Quick Connect drop-down menu is for previous connections.
So enter in those four pieces of information and press the ENTER key. You should see Filezilla connect to your remote (even if it’s just sitting next to you) Linux machine in the dialog box below displaying status:
Below the status line on your left-hand side is the two panes showing your local directory. In my case, it’s my Music directory or folder.
On your right-hand side is your remote directories listing. Now it will show your visible and hidden files and folders, so you may want to scroll down until you reach the directories or folders that you recognize.
Now just drag and drop files between the two directories. It’s that simple.
That’s a brief lesson in how to use Filezilla. As I said, it’s donation-ware, so if you like it, give a few dollars to the cause.
You can find tutorials for more advanced aspects of Filezilla on the Web. Just search for them by typing in Filezilla Tutorial into your Web browser’s address bar.
Why I said this was a future-proof method of connecting your Mac and your Linux machine.
Apple plans to replace its creaky file system, HFS+, which they’ve used for 30 years, with the new and shiny Apple Filing System (APFS). They also plan to deprecate and eliminate the Apple Filing Protocol, which Netatalk currently depends on.
I would speculate that Netatalk, under very active development, will adjust to this change when bringing out new products. So don’t panic.
I will further speculate that Apple will NOT replace the SSH and SFTP protocols. So you’ll still have those to use when connecting your Mac to your Linux machine. So this article will remain valid for some time to come.
I don’t know about Apple’s plans for Apple Filing Systems, other than what I read at AppleInsider and Macworld.com. If you know more than I do, please tell us about it in the comments.
Now on to Part III, where I tell you about a simple way to network your computers using the Dukto file transfer program and the Synergy mouse and keyboard sharing program.
Editor, MacValley Blog