Recently I wanted to share my external NTFS Hardrive connected to my Linux desktop station with my Mac Laptop. I thought about using NFS but I prefered Samba to be able accessing the drive using Windows…
1) The first thing to do is to install/activate Samba ( sudo apt-get install samba smbfs ), if you’re using Ubuntu (>= Hardy) just right click any directory on the NTFS drive and select “Share Folder”, a new box called “Folder Sharing” will open, select “Share this folder” and validate you’ll be prompted to install Samba, proceed…
2) The second thing to do is to allow your current Linux user to share the NTFS drive which is considered as root’s property. If you don’t do that you’ll get a 255 net usershare add error message . Edit the Samba Config File in sudo mode using a Text Editor (ie Gedit):
gksu gedit /etc/samba/smb.conf
And add this line in [global] section (Global Settings) :
usershare owner only = False
BTW add these lines too:
hosts allow = 127.0.0.1 192.168.1.0/24
this will allow connections from localhost (testing purpose) and your private network (192.168.1.0 change it according to your private network address range in which your Mac IP is included)
workgroup = WORKGROUP
or MSHOME depending on your Network Group, this is to allow visibility and connections from Windows Stations.
Check if the security option is enabled on user :
security = user
This will require an account on the Linux machine to access the shares.
3) The third thing to do is to install the samba config manager GUI, it’s the easiest way to manage shares and Samba users, if you’re using Ubuntu/Debian/Fedora install “system-config-samba” package.
Now go to System -> Administration, you’ll see a new entry : “Samba”, click it. (you can also hit Alt+F2 and run gksu system-config-samba)
Create a Samba User in Preferences -> Samba Users
Create a Samba username identical to your current Linux username. For more security choose a different password.
4) Share your NTFS Drive ! Click on “Add Share” and select your drive root path (/media/disk-x) to share the whole partition.
Check Writable and Visible, and DON’T FORGET TO CHECK THE USERS ALLOWED TO ACCESS THE DRIVE in the Access Tab (user created in Step 3)
5) The final Step is to allow access to your samba share from outside (of course if you already run a firewall policy). If you don’t do that you won’t be able to access the shared drive, believe me I tried.
You have to open 4 ports : 137, 138, 139 and 445 in your Linux machine (don’t touch your router).
If you’re using Firestarter there’s an existing rule called Samba (smb) that you just need to add.
Firestarter -> Policy -> Inbound Traffic Policy -> Add Rule
In IP, host or network specify your private network address range (in which your Mac IP is included) using this ip form : 192.168.1.0/24
6) Connect to your Linux Machine from your Mac : Toolbar -> Go -> Connect to Server :
In server adress type :
You’ll be prompted to enter a username and a password, enter the username and password created in Step 3.
Et voilà !
If you want to write the NTFS partition you’ll have to install NTFS-3G (see this post)