0

Both my Android phone and Windows PC cannot access my Samba share despite everything being on the local network. Windows can see RASPBERRYPI but when I try to double click it and view its contents it say the following.

Windows cannot access \\RASPBERRYPI

I have an external USB drive formatted with ext4 and automounted with /etc/fstab using the command. The drive mounts fine and I can create files without sudo.

UUID=123a1aa12-d272-32fa-8rd0-7sb5aa0d7e15 /externalDrive auto nosuid,nodev,nofail 0 0

The mounted folder has these permissions.

drwxrwxrwx   4 pi   users  4096 Apr  3 19:46 externalDrive

The folder I've shared at /externalDrive/localShare has these permisssions.

drwxrwxrwx  2 pi   users  4096 Apr  3 19:45 localShareFolder

The settings in /etc/samba/smb.conf are the following. I cleared all comments and default shares, but even before that I was having the same problem.

[global]
   workgroup = WORKGROUP
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user
   usershare allow guests = yes

[localShare]
   Comment = PiLocalShare
   Path = /externalDrive/localShareFolder
   Browseable = yes
   Writeable = Yes
   only guest = no
   create mask = 0777
   directory mask = 0777
   Public = yes
   Guest ok = yes
1
  • 1) Have you read /var/log/samba/log.%m ? 2) Mountpoint should be /mnt/externalDrive and not /externalDrive. 3) Add to /etc/samba/smb.conf for [localShare] the respective force user = nobody and force group = nogroup.
    – Fabian
    Commented Apr 4, 2018 at 12:50

1 Answer 1

-1

the problem can be:

The Sharing Proprierities in your RPi, you are visible but the contents are blocked;

IP Configuration, the both devices have to be connected by the same way, normally by LAN, because the WiFi's and LAN's IPs aren't the same;

SOLUTION

You can share your Raspberry Pi's files and folders across a network using a piece of software called Samba, a Linux implementation of the Server Message Block protocol. You'll need to install this software:

sudo apt-get install samba samba-common-bin

Samba contains the SMB protocol, support for the Windows naming service (WINS), and support for joining Windows workgroups. A workgroup is a group of computers on a local network that can access eachother's folders. Samba-common-bin contains a tool that you'll need to register users with Samba. Once these packages have finished installing, you need to edit the Samba configuration file:

sudo leafpad /etc/samba/smb.conf &

Find the entries for workgroup and wins support, and set them up as follows:

workgroup = your_workgroup_name wins support = yes

The name of the workgroup can be anything you want, as long as it only contains alphabetical characters, and it matches the name of the workgroup that you want to join.

You also need to add the following section of code to smb.conf:

[pihome] comment= Pi Home path=/home/pi browseable=Yes writeable=Yes only guest=no create mask=0777 directory mask=0777 public=no

Scroll down smb.conf until you see a section called Share Definitions, and add this code there. The path should point to the drive or folder that you want to share. I've set 'only guest' and 'public' to 'no' so that Samba prompts for a password when I visit the folder that I've shared. This means that when I'm using a Windows PC, I can login to the shared folders on my Pi, and I'll have the same read/write permissions that user pi has.

Now type this command in a terminal, and enter pi's password twice:

smbpasswd -a pi

If you have a PC or laptop connected to your workgroup, you should be able to see your Raspberry Pi in Windows Explorer under Network.

I Hope This Help ;)

IanPP

2
  • given the OP is already using samba how does this answer the quiestion? Commented Apr 4, 2018 at 3:06
  • @SteveRobillard Part of this is to confirm if it is well configured and he needs to add thet code to samba.conf
    – yanko
    Commented Apr 4, 2018 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.