Saturday, 26 November 2016

Samba, RPi as Windows file server


             Updated 2017-11-21

If You want that the Raspberry Pi, RPi, shall appear in MS Explorer or Mac Finder, as a File server, the easiest way is to install Samba.

This also makes it much easier if You want to edit files on the RPi with editors from Your MS/Apple device. Or maybe moving files from/to the RPi.

Log on to the RPi and install Samba

$ sudo apt-get install samba samba-common-bin

Edit the Samba configuration file so that You have more than "Read Only" rights.

$ sudo nano /etc/samba/smb.conf

Then find the following part 

#======================= Share Definitions =======================   
                                                                     
[homes]                                                              
   comment = Home Directories                                        
   browseable = no                                                   
                                                                     
# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.    
   read only = yes                                                   

so change to

read only = no

and then save the file
Create a Samba user, maybe pi ? and a password

$ sudo smbpasswd -a pi
New SMB password:
Retype new SMB password:
Added user pi.

Restart the Samba service

$ sudo /etc/init.d/samba restart 
[ ok ] Restarting nmbd (via systemctl): nmbd.service.
[ ok ] Restarting smbd (via systemctl): smbd.service.

and now You should be up and running and the pi folder should be shared

The picture above is from a Mac browsing a RPi running Homebridge and 2 plugin

The RPi is also running an Apache server and therefore I also wanted to share its default folder.
Adding the following to the configuration file solved it.

[Apache_folder]
   comment = Apache folders
   read only = no
   locking = no
   path = /var/www/html/
   guest ok = no






2 comments:

  1. Tack för suveräna guider!
    Jag är nybörjare på raspberry och när jag ansluter till min raspberry med samba på min mac så ser jag inte allt på den. Jag kommer till exempel inte åt min config.json för homebridge. Gissar att det har något med rättigheter att göra, men vet inte hur jag ska ändra dem?

    ReplyDelete
  2. Tjing !
    Tror det beror på vem du loggar på med, default är guest. logga på med pi så lär du komma rätt, hls Mats

    ReplyDelete