upload file to ubuntu server from mac
For quite some fourth dimension I use my Ubuntu auto as a file and fill-in server for all Macs in my network which is perfectly accessible from the Finder in Mac Os 10. There are some instructions bachelor in the spider web for this task but all failed in my instance so I wrote my own tutorial with all the steps needed for it to work properly.
This article is very quondam and has been rendered obsolete for OS Ten 10.ix Mavericks and above. Apple tree uses v2 of the Samba protocol, dubbed SMB2 for file sharing by default now, which includes many technical advantages over AFP. On Ubuntu, the Samba package can exist easily installed and configured to provide connectivity between Ubuntu und Mac Bone X out of the box.
Yous should follow the steps in the following article merely if you desire to setup a Mac with an OS Ten version below 10.9. or you are absolutely sure yous want to use AFP for file sharing.
Then here's my little Tutorial for connecting Mac Os X Leopard with Ubuntu and using your Ubuntu automobile as a fill-in volume for Time Auto but all steps tin be reproduced on every Linux box and they work with Mac OS X 10.4 Tiger as well. At the end of this tutorial you will have a server which shows upward in the Finder sidebar and behaves just like a Mac server when accessing information technology from your Macs. To be perfectly integrated with Mac OS X we're going to use Apple's Filing Protocol (AFP) for network and file sharing.
Although this Tutorial involves using the Terminal in Ubuntu and looks a fleck geeky it'south very piece of cake even for beginners. I accept tried to explain all steps and Terminal commands so you lot may learn a chip virtually the Terminal too. At the end of the article you lot can download my Server Displays icon pack quickly fabricated by me with custom icons for a Mac, Ubuntu and Windows server.
Personally I utilise a fresh installation of Ubuntu viii.04 Hardy Heron Desktop version (32bit on one motorcar, 64bit on the other) and Mac OS X Leopard (10.v.3 and later on) to connect to them. On my Ubuntu boxes there's no other file sharing protocol like samba (Windows sharing) or NFS activated.
Rumors are Apple tree will add together some undocumented AFP commands with the Mac OS X 10.5.half dozen update which therefor won't be supported past the electric current Netatalk package (and maybe never will). So be sure to bank check the latest comments on this commodity when the 10.5.6 update is out to run across if this rumor is truthful and if there are bug acquired by that.
Hither are the steps involved in setting up your Ubuntu box as a Mac file server:
#one. Modify and install Netatalk
Netatalk is the Open Source implementation of AFP. Mac Bone X requires encryption to work properly but the standard parcel of netatalk provided in the Ubuntu repositories doesn't include this characteristic. And then we have to build our own netatalk package from the sources with the encryption feature enabled.
First you have to enable the Source Lawmaking repositories via System > Administration > Software Sources nether the Ubuntu Software tab. Check the Source Code Box, click Close and choose Reload in the side by side dialogue.
Alessandro has built a nice .deb package for i386 machines. Although written in italian you lot can follow the necessary code snippets for installing this package in his blog post. If the install package works for you lot just skip the following self compiling process and caput over to the Configure Netatalk section.
Now fire up your Terminal under Applications > Accessories and execute the following lines (separately). You have to type Y for yes when Concluding asks you lot if it should proceed:
sudo apt-become build-dep netatalk sudo apt-get install cracklib2-dev fakeroot libssl-dev sudo apt-get source netatalk cd netatalk-2 * Now yous take downloaded the source code of Netatalk to your home folder, installed some required packages for edifice Netatalk and changed the directory to the downloaded folder.
Next you lot have to build the Netatalk package with the encryption choice enabled:
sudo DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -rfakeroot Depending on your hardware this may have a while but yous can savour the geeky build output in your Concluding:
If everything went through without errors (except the signing warnings, can be ignored) you can install the recently created package:
sudo dpkg -i ~ /netatalk_2 * .deb To end Ubuntu from overwriting your custom Netatalk parcel you should set its land to hold. This will cause the Netatalk package being grayed out in the Software Update dialogue:
repeat " netatalk hold " | sudo dpkg --fix-selections Now you lot have successfully build and installed your custom Netatalk package which now has support for encrypted logins. At present let'southward configure the whole thing.
#2. Configure Netatalk
Get-go you lot should deactivate services provided by Netatalk which are not needed if you lot simply want to use your Ubuntu box for file sharing. This will speed upward the response and startup time of Netatalk dramatically. For case Netatalk starts the erstwhile AppleTalk protocol by default which is merely needed for pre Os X systems. So we're going to employ the graphical editor vi for stopping unneeded services:
sudo vi /etc/default/netatalk vim should popular up with the defined file loaded equally superuser (needed for saving). Find the "#Fix which daemons to run" part and replace the default values with these to enable but AFP and disable all unneeded services. Allow the cnid_meta daemon run too and if you lot desire to share your Linux connected printer with your Mac also enable the pap daemon (set to yes):
ATALKD_RUN=no PAPD_RUN=no CNID_METAD_RUN=aye AFPD_RUN=yes TIMELORD_RUN=no A2BOOT_RUN=no Here it's very important to run the cnid_meta daemon because this service will handle all the metadata for united states of america (namely the reosurce fork) which would go lost due to the fact that your Linux box isn't formatted as Apple'southward HFS+. If you lot're interested what the other services could practice: atalkd is the AppleTalk daemon (pre-OSX file sharing, old press), timelord can make your Linux box a network time server and please don't ask me for what a2boot is good for (If you know it, post it in the comments please / Kelly suggests information technology's a netboot server for client Macs).
Printing Ctrl + Southward to relieve the document or cull File > Save. Next we have to edit the primary config file for AFP sharing called afpd.conf:
sudo 6 /etc/netatalk/afpd.conf Scroll to the very bottom of the certificate and add together this to the bottom (replace the whole line in example there's already 1). This is one line so be certain that there's no line break in your afpd.conf file:
-transall -uamlist uams_randnum.then,uams_dhx.and then -nosavepassword -advertise_ssh Press Ctrl + S to save the certificate or cull File > Save.
At present nosotros have to tell the afpd daemon what Volumes to share. This is defined in the AppleVolumes.default file inside /etc/netatalk/. The post-obit line will open this file in vim with superuser privileges (required for saving) where we tin ascertain our shared volumes:
sudo half dozen /etc/netatalk/AppleVolumes.default Curl to the bottom of the certificate and define your Book shares. By calculation the following line yous will share each users home directory with the user proper noun as the Volume proper name. To make things more secure you tin can define all users who are allowed to connect to your Ubuntu box via AFP:
~/ "$u" allow:username1,username2 cnidscheme:cdb Because nosotros want to use the Ubuntu machine as a backup server for Time Machine you should ascertain a 2d volume only for Time Machine. Create a new folder in your home directory first and name it TimeMachine (or anything you similar). So add the following line to your AppleVolumes.default. This is one line so exist certain that there's no line break in your AppleVolumes.default file:
/domicile/username/TimeMachine TimeMachine let:username1,username2 cnidscheme:cdb options:usedots,upriv Cheers to tsanga for pointing out the usedots and upriv options. The usedots option is required if you want to utilise invisible files and folders (those starting with a dot in the name). Otherwise afpd would encode them as :2e which is bad if you take to use invisible files (like .htaccess). If you're on Leopard and accept no Tiger installed Macs in your network or mixed Bone Ten versions in your network you should use the upriv selection which adds back up for AFP3 unix privileges. If you lot have Macs with Tiger installed just use options:usedots to avoid unexpected beliefs:
/home/username/TimeMachine TimeMachine allow:username1,username2 cnidscheme:cdb options:usedots Finally if you want more stability and tin accept slower file transfers you lot can utilize the dbd cnidscheme (cnidscheme:dbd).
Press Ctrl + S to save the document or choose File > Salvage. Of class you tin ascertain every folder you lot similar or even an attached USB disk. Just define the correct path. External drives in Ubuntu should exist institute under /media
Finally restart Netatalk to activate the changes:
sudo /etc/init.d/netatalk restart Although we now accept a fully configured AFP file server information technology will not show upward in the Finder sidebar on Mac Os X Leopard (but it'southward reachable via Get > Connect to Server… in the Finder). Macs apply a service called Bonjour for the sidebar affair (and for a lot of other cool stuff) and on the Linux side we tin can have this functionality with the Open Source implementation of Bonjour, chosen Avahi.
#iv. Install Avahi
So the Avahi daemon volition annunciate all defined services beyond your network just like Bonjour do. Then let'southward install the avahi daemon and the mDNS library used for imitating the Bonjour service. When fully configured this will cause all Macs in your network to notice your Ubuntu box automatically:
sudo apt-get install avahi-daemon sudo apt-get install libnss-mdns To make everything work properly you lot have to edit the nsswitch.conf file:
sudo vi /etc/nsswitch.conf Just add together "mdns" at the end of the line that starts with "hosts:". Now the line should look similar this:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns Press Ctrl + S to save the document or choose File > Save.
#5. Configure Avahi and annunciate services
Next we have to tell Avahi which services it should advertise across the network. In our example we just want to advertise AFP sharing. This is done past creating a xml-file for each service inside /etc/avahi/services/ post-obit a special syntax. Permit's create a xml-file for the afpd service with the post-obit line:
sudo vi /etc/avahi/services/afpd.service A blank document should open up in vim. Now paste the following into the document and relieve the file by pressing Ctrl + S or by choosing File > Salvage:
<? xml version = " 1.0 " standalone = ' no ' ?> <!-- *-nxml-* --> <! DOCTYPE service-group SYSTEM "avahi-service.dtd" > <service-group> <proper noun supercede-wildcards = " yep " > %h </name> <service> <type> _afpovertcp._tcp </type> <port> 548 </port> </service> <service> <type> _device-info._tcp </blazon> <port> 0 </port> <txt-record> model=Xserve </txt-tape> </service> </service-group> update: The final part is used to assign a specific (Apple) hardware model to your Linux box. In this example your server volition be advertised equally an XServe and will be shown with this icon in the Finder sidebar. This will come in handy when yous desire to employ your own icon for it or the one's made by me provided inside this article. Thanks to Simon Wheatley for figuring this out. Additionally you lot tin use these models in this file: RackMac (aforementioned equally Xserve), PowerBook, PowerMac, Macmini, iMac, MacBook, MacBookPro, MacBookAir, MacPro, AppleTV1,1, Airport
Finally restart the avahi daemon to actuate all changes:
sudo /etc/init.d/avahi-daemon restart At present you lot have configured the Avahi daemon to annunciate AFP sharing beyond your network which volition crusade your Ubuntu box to show up in Finder'southward sidebar in Mac OS Ten Leopard. In Mac OS X 10.4 Tiger your Ubuntu server should now be visible under Network.
Now you lot're done with setting upwardly AFP file sharing on your Ubuntu box and advertising it across the network for Finder'south sidebar. Cheque if everything works equally intended by clicking on your Ubuntu server in Finder and clicking on the "Connect As" button. Enter your username and countersign (the ones you're using on your Ubuntu machine) and yous should see the Volumes we defined earlier with the AppleVolumes.default file:
Another side upshot of using AFP is that your Ubuntu box will show upward as a squeamish Apple Picture palace Display icon instead of the BSOD windows icon. Hither you see my Ubuntu server showing up in Finder every bit Rockhopper:
update: If y'all've followed the revised version of this article your Linux box should at present be represented by a Xserve icon in Finder:
#6. Configure Time Automobile
update 07/fourteen/2008: On the Mac side you have to enable the pick to use network volumes as Time Auto drives kickoff. Without information technology your freshly shared and advertised network book won't prove up in the deejay selection dialogue in Time Car. This is a hidden option not accessible via the graphical user interface so you have to re-create & paste this in Terminal (it's 1 line):
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1 Thanks to FoolsRun and tsanga for pointing this out in the comments
Now just mount the "TimeMachine" Volume first and choose information technology as a backup disk in the Time Motorcar system preferences. Fourth dimension Machine will create a sparsebundle disk image inside the book and mounts that as well. This is needed because the hard drive on your Ubuntu box is formatted equally ext3 or Reiserfs and not the native Mac format HFS+. Considering Time Machine backups everything to the disk prototype all metadata (like cosmos dates etc.) will exist preserved.
When your start Time Machine fill-in is done you can remove all Volumes and the next time Time Machine starts it will automagically mount the disk paradigm from your TimeMachine volume on your Ubuntu box without mounting the whole TimeMachine volume:
#7. Conclusion, Problems and more informations
You run into that Linux and Ubuntu can be configured to deport like Macs in your network. Only it'southward distressing, that you have to fire upwardly the Concluding to achieve this. I hope peculiarly the Ubuntu team will simplify this in future versions. Another lamentable thing is that Ubuntu is missing a useful avahi/Bonjour and AFP implementation for Nautilus, the file manager. So there's no style to access your Mac from Ubuntu via AFP in the file manager. In my network I use SSH to access the Macs from Ubuntu or Linux by allowing Remote Login on the Macs in the Sharing preferences. But there's a command line based AFP client bachelor called afps-ng which uses the FUSE system.
Some other strategies of connecting Ubuntu/Linux and Mac Os X would involve sharing via Samba (Windows sharing) or NFS but according to my experiences zero beats the speed, stability and secureness of AFP.
But if you're interested you tin can accept a look at this mail on the ubuntuforums to learn how to setup NFS for file sharing between Ubuntu and Mac OS 10 Leopard.
Although I have checked all log files while using file sharing and particularly while Time Machine is running and found no errors or warnings I cannot guarantee it'southward working without errors or fill-in data loss on your system besides. And so I encourage y'all to cheque the system logs on Ubuntu AND on Mac Os X with the Console app in your Utilities folder. If you run across no errors or warnings this configuration should exist pretty bullet proof in terms of stability.
Finally the only problem remaining is that your Ubuntu or Linux box isn't formatted as journaled HFS+ so some scenarios would fail or brand bug. This tin can include having your iTunes, iPhoto or Aperture library on your Ubuntu server. But the cnid_meta daemon volition always try handle that for the states. This will cause some hidden folders to show up in Ubuntu which are used to shop all the metadata required to almost reproduce a HFS+ file system. But if y'all e'er run into problems y'all can easily resolve these by creating sparse disk images on your server with the Disk Utility built into Mac Os X. Just create a new thin deejay image on your desktop, copy it to your mounted Ubuntu book and mountain the copied disk image past double clicking it. Now yous can put all the files and libraries in information technology which depends on HFS+
#Issues with creating the backup deejay image
If Fourth dimension Car says "The backup disk paradigm could non be created" during the first backup endeavour you can practice the following to avoid this problem and some others (fill-in neglect due to permissions):
In short, you take to create the backup disk image on your Desktop and re-create it to your mounted Time Car book. But Time Machine creates a unique filename for the disk epitome and nosotros tin find out this proper noun with a little trick:
Outset open up the Panel from your Applications > Utilities binder and open the Fourth dimension Machine preferences. In Time Machine preferences set your backup volume back to none. After that reselect your mounted Fourth dimension Machine volume. The counter should start and Time Machine's big button will change to on. When the backup tries to showtime and neglect have a await at your Console (Click All Messages in the sidepane). There should be a line telling y'all the proper noun of the disk image:
Creating deejay epitome /Volumes/TimeMachine/computername_0014e3856bd0.sparsebundle The computername should exist the proper name you have assigned to your Mac. At present just click on that line and hit control + C to copy the message.
Now Open Disk Utility from your Applications > Utilities folder and click on New Image in the toolbar. At present simply hit Command + V in the Relieve As field and remove everything earlier the name of the sparsebundle.
The secret number Time Automobile adds to your computer name is cypher more than the MAC address of the network device that your Mac uses to talk to your server, as Simulacrum and Todd plant out in the comments. Every bit he points out you tin open up up Network Utility and under the info tab you lot'll find a field called "Hardware Address". Simply remove the colons and you have the number Time Automobile adds to the disk epitome name.
In the field volume name write Fill-in of computername. Now FIRST chose sparse package deejay image every bit the prototype format and so adjust the volume size to the size of your internal harddrive (minimum, choose more if you like) afterwards. Remember that Disk Utility won't let yous brand a bigger image file every bit you have physical hard drive space available if yous don't chose thin packet deejay image equally the image format first. For reference have a expect at this screenshot:
Select your Desktop every bit destination and click create. After the creation is finished drag the created disk paradigm to your mounted Fourth dimension Automobile book (you lot tin delete the disk image on your desktop when copy is finished). Finally get to Time Machine preferences and start your backup once again and everything should work every bit expected now. Later the beginning backup (this can take a long time depending on your harddrive) you can unmount your Time Machine volume and the next time Time Machine starts it volition grab and mountain the sparse package disk paradigm automatically (with "Backup of computername" as the volume name).
#Firewall Settings
As Kevin points out in the comments you would accept to arrange any firewall you utilise. But the standard Ubuntu installation won't apply any Firewall.
In brusk you lot take to allow communications over port 548 and 5353.
#"Connection Failed"
If you lot become 1 of those errors:
Connection Failed - There was an error connection to the server. Check the server name or IP accost and endeavor once more or
At that place was an mistake connecting to the server. Check the server name or IP address and attempt again. If you are unable to resolve the problem contact your system administrator. you should get-go exist certain you accept either no firewall on your Ubuntu box in use or take information technology configured to let AFP communications equally suggested in the in a higher place paragraph.
Remember that this error can exist caused by a myriad of problems and just a lot of other configurations on your side. And then yous should endeavor a minimal way: On my Ubuntu boxes I take no other file sharing protocol like samba or NFS enabled (even not installed) so the samba hostname and the AFP hostname can't interfere with each other. Likewise I've left the Workgroup field bare under Organization > Administration > Network > Full general tab.
If you lot still can't connect to your Ubuntu box you lot can edit your /etc/hosts file equally I've pointed out in the comments:
sudo vi /etc/hosts Add the following two lines at the very top of the file.
127.0.0.1 localhost 127.0.ane.1 Rockhopper.local Rockhopper My server is named Rockhopper, adjust the name according to your server proper noun. At that place should be some sort of proper noun already just the important part hither is the servername.local which is the AFP fashion of server names. If there are whatsoever other numbers at the starting time in your file leave them equally they are.
If that won't solve the connection problems you can exam out Eric's solution as suggested in the comments which would involve removing and reinstalling netatalk.
Pitiful I can't give yous any other solutions for that simply in most cases it'southward some sort of network misconfiguration outside of netatalk or avahi and on Linux these tin can be a lot of configurations on your side I can't know of. And since I'm not able to reproduce these errors I can't investigate in them.
But for those people withal having problems with these error messages: On Mac Os X accept a wait in the Console app inside your Utilities folder. Click on "All Letters" in the left sidebar, try to connect to your Ubuntu box in Finder and encounter the messages in Console. These are the "existent" mistake messages which ordinarily volition pb you to a solution.
#-5014 error
Some people have issues when connecting to an AFP share and get a -5014 error. You accept to delete the hidden .AppleDB folders on your Ubuntu box and restart netatalk afterwards:
sudo /etc/init.d/netatalk restart #Time Machine Full System Restore
In case of a full organization restore you would take to boot your Mac from the Mac OS 10 installation DVD (the one delivered with your Mac) past pressing the c key during boot. Your Mac will start with a minimal UI where you take a Utilities section in the top carte du jour bar. There yous'll detect "Restore from a Time Car Backup" but information technology won't observe your network share with your Time Machine fill-in. Luckily Dmitry Nedospasov found a manner to manage this past simply mounting your Time Machine network share with the Terminal (which you can find nether Utilities in the carte du jour bar too) past utilizing the following syntax (shamelessly copied from Dmitry):
mount -t afp afp://username:password@hostname/ShareName /Volumes/ShareMount Supercede everything instead of /Volumes with your matching names. You can exam if your network share was properly mounted by doing
ls /Volumes which outputs the content of the Volumes binder and you should see your network share.
At present you can shut the Concluding and select "Restore from Time Machine Backup" from the Utilities entry in the menu bar and select your mounted Time Machine fill-in and thats information technology. Oh, needless to say: a gigabit ethernet connexion volition speed things up dramatically even compared to (typhoon)n-WLAN.
#Netatalk fill-in disk reaching maximum chapters
There is some discussion on the net regarding problems with Netatalk and TimeMachine when the backup disk reaches maximum capacity. This is due to missing support for the AFP commands FPSyncDir aka commands 78 and 78 in Netatalk. As a commenter in an ArsTechnica forum says: "As soon equally your backup book volition reach max capacity, it will cocky destruct because of it."
In the forum you'll likewise find some links to various patches to avoid issues with that. If yous have tested such patch please postal service your experiences in the comments for this article.
#More Manufactures
- In case y'all want to connect your iPhone via AFP: An AFP Server on your iPhone. This uses the Netatalk package as well
- Netatalk 2.0 manual
- All possible AppleVolumes.default options (part of the Netatalk manual)
- Overview and templates about services Avahi tin can advertise
- In-depth article nearly Sparse Bundle disk images
- How-to: Get files off a Time Motorcar fill-in without using your Mac: In example you have to admission Time Machine backups from Ubuntu or whatsoever other Linux arrangement
- Using NetBSD, with invitee account: Johannes laid down the steps to use NetBSD instead of Ubuntu.
#8. Downloading and using the Server Brandish Icons
I've quickly crafted a custom icon for your Ubuntu server. It's the Apple tree Cinema Display with the default wallpaper of Ubuntu 8.04 called Hardy Heron. Additionally I've included an icon with the default Leopard and the default Vista wallpaper to represent your Leopard and Windows server too (The default Mac server icon uses the old Tiger wallpaper).
Here you tin come across the icons included in the Server Displays icon pack:
Considering I've only modified Apple'southward standard icons these icons are just available via this web log mail service and they volition not show upwardly in my Goodies section. Just download the whole package directly via this link:
Download Server Display Icons zip
#How to use the icons
In the avahi configuration function in this commodity you take assigned the Xserve device info to your afpd.service file. All you have to do is to replace the generic Xserve icon (or whatever model you have assigned in your afpd.service file) with an icon from this icon package. Just rename the Ubuntu Server.icns to com.apple tree.xserve.icns and navigate to
/System/Library/CoreServices/CoreTypes.packet/Contents/Resources Drag & drop the renamed file into this path and supervene upon the generic icon (making a backup earlier doing that is a skillful idea) and after a logout all your avahi advertised Ubuntu servers should be displayed with the new icon (assuming that you assigned a device model in avahi).
If you've used some other model in your afpd.service file, browse the Resources of CoreTypes.parcel to get to know the correct filename for the device icon and supervene upon that file.
Equally for the Windows Vista server icon: Just rename the Windows Server.icns file to public.generic-pc.icns and navigate to
/Arrangement/Library/CoreServices/CoreTypes.bundle/Contents/Resources Now drag & drop the renamed file into this path and replace the generic icon (making a backup before doing that is a good idea) and after a logout all your Windows servers should be displayed with the new icon.
update: A solution for the icon problem is hither: Simon Wheatley figured out how to assign a different icon to your avahi advertised Linux box. All you have to do is assigning a device info part at the finish of the avahi service file for AFP. I've updated this article to include this part. Please head dorsum to the Configure Avahi and annunciate services part in this article and edit your afpd.service file again if y'all've followed the first revision of this article.
Congratulations! You finally arrived at the end of my commodity. There's a good chance that your coffee or tea cup is now empty. But before making your next coffee you should share this article on your favorite social website. Your vote is highly appreciated! After yous've finished voting and making your next coffee or tea you could subscribe to my RSS-Feed, discuss this commodity or buy me my side by side coffee.
#9. Translations Of This Article
The post-obit articles are direct translations of my article but some of them are slightly modified or simplified. Think that the authors/translators are responsible for the content.
- German: Ubuntu + Apple tree Fileserver + TimeMachine on kde4.de
- French: Tuto: Annotate créer votre serveur Fourth dimension Sheathing sous Debian on the Weblog of Pierre de la Celle
Source: https://kremalicious.com/ubuntu-as-mac-file-server-and-time-machine-volume/
0 Response to "upload file to ubuntu server from mac"
Post a Comment