February 1, 2022

Raspberry Pi NAS for iOS, OSX and Windows using Samba

Interoperable with all iOS, OSX and Windows devices

I have tried and failed number times during this project. But, as of today everything is working as expected on all my devics - ipad, ios, mac and windows. The primary reason for so many hiccups was the Apple side of things. When it worked on iOS, it failed on OSX and vice versa. They use samba in a different way.
Samba is pretty ancient and the older versions are pretty vulnerable. So, most of the platforms are deprecating Samba 1. If you are using older versions of samba, please make sure to add extra layers of security.
Lets start setting up os little NAS server.

**About my Build - currently using this NAS and pi-hole on Raspberry Pi 3B+

1. Uninstalling Previous Samba Installations

You might have tried installing samba and changing things. We certainly don't want any of that conflicting with our new setup. So, its best to uninstall everthing and start fresh.

sudo apt purge samba samba-common avahi-daemon

This should uninstall everything that you might have installed with your samba including smb.conf file

2. Installing Samba and Avahi-daemon

Samba handles the protocol and file management side of things. While, Avahi manages things for the apple side. Its purpose is to say "hey I am a genuine timemachine. So treat me like one!"

sudo apt install samba avahi-daemon

Now that you have a fresh samba installation, lets move on to setting up few more things

3. Adding user for Linux and Samba

We need to add a new user to our linux system. You'll be using this user for logging into your NAS from remote machine.

The name of the user that I am adding is 'rasp'

sudo adduser rasp

Congrats! You have adding a user to your Linux but samba doesn't know what to do with it yet. So, we'll create a samba password for this user - 'rasp'

sudo smbpasswd -a rasp

You'll be using this password for logging into your NAS server. You don't need to go too hard as typing might get difficult on phones.

4. Creating a Shared folder

Now, we can move on to creating a folder that will be shared on your network. Anything in this folder could be accessed by the remote machines.

sudo mkdir /mnt/raspmachine

5. Mounting Storage in Shared folder

sudo mount /dev/sda1 /mnt/raspmachine

if the drive is already mounted you need to unmount it first with

sudo umount /dev/sda1

If its not unmounting, then you might want to use these

sudo umount -f /dev/sda1


sudo umount -l /dev/sda1

Lazy unmount should do the trick in most of the cases.

6. Permission for Shared folder

This is an important step which gets overlooked during the process. I believe that this could have been the biggest culprit for some of the troubles I have had setting up my NAS. This possible leads to OSX and iOS error codes - 100093 and 50 . I haven't dug deep into it.

Chown givers our user the absolute authority of the folder raspmachine and everything inside it.

sudo chown -R rasp: /mnt/raspmachine

If you want to add multiple users, you might want to consider adding users to a group.

7. Editing the smb.conf file

smb.conf stores information about how the samba server is supposed to work. For this project we need to add a few lines at the end of our smb.conf.

Smb.conf is located in /etc/samba. You can use nano, cat or any editer of your choice to open it.

sudo nano /etc/samba/smb.conf

After this, you need to place the following lines at the bottom.

you me add things according to your need. But, if you want this system to be compatible with apple devices, you cannot skip creating a vfs object.


   comment = MyShare

   path = /mnt/raspmachine

   valid users = rasp

   read only = no

   vfs objects = catia fruit streams_xattr

   fruit:raspmachine = yes

Once you're done with it, you need to save the file by -

control + O , enter

and then,

control + X, enter ( to get back to the terminal )

8. Testing the configuration

You may skip this step. It's only to check what settings are in effect. If you have made a typing error, you'll notice it.

sudo testparm -s

9. Restart Samba Service

Our samba is all set to work. But, the changes that we have made are not active yet.  So, we need to restart the samba service.

sudo service smbd reload

10. Testing - Try connecting via your devices

Note - For any server setup, its highly recommneded that you set an static ip address from your router.


If your raspberry is not visible on you network, you can go to search bar and type the address of your raspberry pi.  



\\{ip address of raspberry pi}

iPhone/iPad -

Tough you may use other apps but Files is the most convenient one. You can easily share your photos and documents on your raspberry via files. The process is fairly easy and involves only 3 steps.

  1. Go to files
  2. Connect to a server
  3. Enter the ip address and you'll be prompted for id and password

Mac -

Finder is your friend here.

Have Questions?Feel Free to Reach Me