In this tutorial we will look at how we can connect to our Raspberry Pi in order to transfer files. Before we start, you will need to enable SSH in the raspi-config menu. For more information see the beginning of this tutorial. Once completed we will be able to connect to our Raspberry Pi using Windows Explorer on Windows and Finder on Mac OS X: this allows for very easy file transfers.

Installing Samba

We will be using Samba to transfer files over our local network to the Raspberry Pi. Connect to you RPi via SSH (or alternatively use it as nature intended with a mouse and keyboard and open up terminal).

Before we download Samba, we need to update apt-get because the version that comes with Raspian is usually out of date (plus it’s good to keep things updated). Type in sudo apt-get update

Once done we can type in sudo apt-get install samba samba-common-bin

Install Samba

Install Samba

This will install Samba from the online repository (as we did when we installed our VNC Server). When asked if you wanted to install type y and hit enter, then wait for it to be installed.

We now need to add users to Samba which we can do by typing in sudo smbpasswd –a user but replace user with your desired account. We will add pi and when prompted we recommend you use the same password for Samba as the system password for pi.

sudo smbpasswd –a pi

sudo smbpasswd –a pi

Enter your desired password and the user will be added.

We now need to alter Samba’s configuration which is kept in a file in /etc/samba. Navigate to this folder by typing in cd /etc/samba and then type ls to view the files.

/etc/samba

/etc/samba

We want to edit smb.conf but first we should make a backup of this file. Type in sudo cp smb.conf smb.conf.backup

This will copy smb.conf to a new file with the extension .backup (the extension can be anything, just as long as we have a copy of this file that doesn’t have the same name). We can now go ahead and edit the configuration file, so go ahead and type sudo nano smb.conf

Editing Samba’s Configuration File

Editing Samba’s Configuration File

If you want to transfer files from a windows computer then first scroll down to Global Settings and enter your windows workgroup to the option workgroup.

Enter Your Workgroup

Enter Your Workgroup

If you don’t know what your workgroup is called in windows then right-click on Computer from the Start Menu and click Properties. Note that the default workgroup is ‘WORKGROUP’ but some users may change this.

Your Workgroup

Your Workgroup

Next scroll down to Authentication and remove the # from # security = user

Remove the #

Remove the #

This will tell Samba to only allow users who have home directories on the RPi. This will make it much more secure. If you want to allow users to view their own directories then scroll down to Share Definitions and under [homes] change browseable to yes and read only to no.

Allow Users to Edit Their Home Folders

Allow Users to Edit Their Home Folders

Click CTRL-X and type y to save. We have now configure Samba and so we now need to restart it, which we can do by typing sudo service samba restart

Restart Samba

Restart Samba

Connecting on Windows

Now that we have installed Samba on our Raspberry Pi, we can now connect to it with Windows. Open up the Run window (from Start > All Programs > Accessories > Run) and type in \IP Addressuser but enter your Raspberry Pi’s IP Address and username. If you don’t know your RPi’s IP Address you can find it in your router’s settings panel or by typing ifconfig into the RPi terminal.

Network Info

Network Info

The RPi’s IP Address is written after inet addr.

Run

Run

You will be prompted to login so enter your username and password

Login

Login

An explorer window will then open displaying your home directory. If you did not enter a username, you will be able to connect but will be denied access to any folders since we did not enable a public folder.

Connecting on Mac OS X

Connect to Server

Connect to Server

Open up finder and select Connect to Server from the Go menu

Enter your IP Address

Enter your IP Address

Type in smb://IP ADRRESS but enter your Raspberry Pi’s IP Address. If you don’t know your RPi’s IP Address you can find it in your router’s settings panel or by typing ifconfig into the RPi terminal.

Network Info

Network Info

The RPi’s IP Address is written after inet addr.

Enter your Login Details

Enter your Login Details

You will be prompted to login so enter your username and password. Finally select the folder you wish to mount.

Mount Folder

Mount Folder

A new finder window will then open displaying your home directory. If you select connect as Guest, you will be able to connect but will be denied access to any folders since we did not enable a public folder.