Share file from an Orange Pi (Armbian) or a Raspberry Pi (Raspbian) with Samba

Black Friday on Amazon right now! Black friday Banggood Gearbest Black Friday
Extra 10% off For XIAOMI SUPER HOME TECH GADGET Sale

Smart Home kits, security camera, robot vacuum cleaner, air purifier ... *Excluding products already on promotion

Reveal
35 days left

In this tutorial we will learn how to install and configure the Samba file server. The Orange Pi – or any other mini-PC in the Raspberry Pi family – can do almost as much as a Windows PC or Mac but you often need to share files with others Computers (or mini PCs) on its local network. Unfortunately, either on Raspbian or Armbian, nothing is installed by default. Fortunately, in the Linux world, there is always an open source solution for all needs. This tutorial applies to both Raspberry Pi and Orange Pi, with or without graphical interface (server version).

Install Samba under Armbian or Raspbian

Samba is a proprietary protocol (SMB / CIFS) developed by Microsoft. It’s a cross-platform project. It allows file exchange and network sharing. It works on Linux, Windows and MacOS. To install it, open a Terminal and run the following command

This command installs Samba and Cups for printer sharing. If you do not need printer sharing, simply run

Configuring Samba

Before changing the configuration, let’s first make a backup copy of the file

smb.conf

Create a new configuration file

Paste this configuration into the file and replace the name of the workgroup – here WORGROUP – by yours.



The name defined by the netbios parameter will be displayed in the file manager under Windows and the Finder under macOS.

If you do not know the name of the workgroup, open the command prompt under Windows (or powershell) and run the following command

Save the configuration file – CTRL + X then Y – then restart the samba service

Allow users to access the share folder

It is possible to allow any user to access the shared folder. Here, I suggest you keep control of your mini PC and allow only users declared on the system.

Samba is able to use the users already present on the system. However, you must create a password that is dedicated to samba. Consider for example the user pi (by default, nothing prevents you to create a pi user on Armbian at the installation), run the following command to set the Samba password

You can re-enter your password or create a new one. Run this command again to change the Samba password. The advantage is not to multiply the users on your environment.

Add Sharing Folders

You can share existing folders. For security, it is best to control access to shared folders. To do this, we will create a new share folder where you can add other directories. Each directory has these access rights. The location of the file is not important. Here we will create the shared folder directly on the desktop.

Now we will add these folders to the configuration file

Then paste this parameter block. Do not forget to adapt paths to your configuration

Update the Samba service configuration

Now that everything is set up, all you have to do is take the new parameters into account. To do this, save the file (CTRL + X then O) and execute the following command

To know the state of the service



Pour arrêter le service Samba

To restart it (after each modification of the configuration file), execute the command

Access a Raspberry Pi or Orange Pi from macOS

Once Samba has been restarted, open the Finder. On the Finder, the Samba share will be added to a list of shares. This connection method can cause problems. To access the shared folder, it is better to “mount” a network drive. To do this, open the Go menu and choose Connect to Server … (the last option in the menu).

samba macos finder se connecter au serveur

In the address field, type smb://sharename/ . To open the shared folder when opening macOS, click the plus (+) button to add it to the list of preferred servers.

 samba macos finder adresse serveur orange pi raspberry

macOS connects to the server. Identify yourself. Check the Keep this password in my keychain box to avoid having to re-enter your password every time you log in.

samba finder macos authentification

So, you can now exchange your files very simply with a Raspberry Pi.

 samba finder macos dossier partage shared folder

Access the shared folder from Windows 10 (or 7, 8, 8.1)

On Windows, it’s a bit the same as on macOS. In the search field (Cortana under Windows 10), locate the Run command.

samba windows executer connexion dossier partage

In the field, type \\name_samba_server  and then OK.

samba windows executer connexion dossier partage

Identify and check Remember my credentials.

The folder shared with your Raspberry Pi or Orange Pi opens.

samba windows 10 armbian raspbian dossier partage

So, you can now upload your files from any other workstation on your local network. The installation and configuration is exactly the same on Raspbian (Raspberry Pi), Armbian (Orange Pi, Cubie Board …) or any PC running Linux. You will be able to access your files both from a Windows PC and MacOS. In this tutorial, we have seen a minimal configuration. Samba is much more powerful. You can manage groups of users, share a printer … To go further, you can read this documentation.

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

DIY Projects