Daily Archives: May 18, 2015

Sharing files between the Raspberry Pi and Windows 8

In order to share files between the raspberry pi and Windows we need to install samba:

sudo apt-get install samba samba-common-bin

We are going to use a dedicated user, samba, for all file sharing and will be using their home folder als share location. This means we first need a new unix user

sudo adduser samba

In addition, we also need to set up this user as a samba user

sudo sambapasswd -a samba

Now the tricky part. Basically all samba functionality is controlled via one file, smb.conf. In it, we can specify the security and authentication settings and which folders and services to share. After backing up the file

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.$(date +%Y-%m-%d)

we are going to create a new file with the following info:

sudo rm /etc/samba/smb.conf
sudo vi /etc/samba/smb.conf
[global]
    workgroup = WORKGROUP
    netbios name = pi
    server string = Pi Samba Share
    encrypt passwords = True
    security = user
    socket options = IPTOS_LOWDELAY TCP_NODELAY
    wins support = no

[PiShare]
    comment = Pi Samba Share
    path = /home/samba
    read only = No
    valid users = samba

All that is left to do is restarting the service.

sudo service samba restart

You should now be able to access the share folder by opening a winwows computer in the same network (and workgroup!), and connecting to //pi/PiShare with the user pi\samba and the password you selected above.