10

I'm trying to set up an SMB share on my network using Samba.

I followed the directions here as well as I could as I have Raspbian installed on my Pi. When I plugged in my USB drive it automounted to /media/Media/ so I skipped the first part.

What I did was the following:

  1. sudo -i
  2. apt-get update
  3. apt-get upgrade
  4. apt-get install samba
  5. apt-get install samba-common-bin
  6. Edited samba config

    Load smb config files from /etc/samba/smb.conf  
    rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)  
    Processing section "[usb]"  
    Loaded services file OK.  
    Server role: ROLE_STANDALONE  
    [global]  
        workgroup = WORKGROUP  
        server string = %h server  
        map to guest = Bad User  
        obey pam restrictions = Yes  
        pam password change = Yes  
        passwd program = /usr/bin/passwd %u  
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .  
        unix password sync = Yes  
        syslog = 0  
        log file = /var/log/samba/log.%m  
        max log size = 1000  
        dns proxy = No  
        usershare allow guests = Yes  
        panic action = /usr/share/samba/panic-action %d  
        idmap config * : backend = tdb  
        valid users = %S  
        create mask = 0700  
        directory mask = 0700  
    
    [usb]  
        comment = USB Share  
        path = /media/Media  
        read only = No  
        create mask = 0777  
        directory mask = 0777  
        guest only = Yes  
        guest ok = Yes
    

So the setup appears OK, I can see the files in /media/Media on the Pi, I can see RASPBERRYPI in my workgroup from my Windows7 box. But when I try to access it I get a logon failure. I also have a 2nd pi with RaspBMC installed and I also cannot access the SMB share from there either.

Is there something else I need to do in Samba to get this working?

Edit:
I did some more work on this last night. I added a new user to the Raspberry, set a password, added a new user to Samba, set the password and added the following lines.

[global]  
security=user  
[usb]  
allow users biff

(or something similar I forget the exact syntax)

And now I've managed to get an error like... "You do not have authorization to access this share". I'm thinking perhaps I'll work on my Pi directly tonight instead of using putty and perhaps there is something I'll be able to see when using a text editor instead of vi.

Resolution

Ok I finally resolved this. The problem was that I could not use the pi login to access the pie using smb and also that I could not change the permissions of the automounted /media/Media drive.
I found my solution here https://superuser.com/questions/57092/cant-change-permission-ownership-group-of-external-hard-drive-on-ubuntu
I had to install ntfs
sudo apt-get install ntfs-config
and then I ran the ntfs configuration tool which just gives anyone read/write access.

Not the best solution but it is sufficient in my case for sharing files on the network.

Biff MaGriff
  • 291
  • 2
  • 4
  • 14
  • what is the exact error you get on your windows box? – Mose Nov 06 '12 at 06:35
  • @Mose The specified network password is not correct. – Biff MaGriff Nov 07 '12 at 04:49
  • Not related to what you have asked, but you can also mount your Pi on Windows over SSH - http://dokan-dev.net/en/download/#sshfs – Lord Loh. Nov 07 '12 at 18:51
  • @LordLoh. Thanks Loh, my ultimate goal here is to have an always on network share that my Raspbmc, Wii and Windows machines can access so I don't have to have my main computer on all the time. – Biff MaGriff Nov 07 '12 at 19:18
  • Can you try this? Give the Username as RASPBERRYPI\pi(where pi is a user in raspberry pi) and password as the password of the user.PRobably you have already tried this but just in case :) – SteveIrwin Nov 07 '12 at 19:27
  • @SteveIrwin Thanks, I haven't tried that, I'll give it a shot tonight. – Biff MaGriff Nov 07 '12 at 19:36
  • @BiffMaGriff-Did any of the suggestions work for you? – SteveIrwin Nov 09 '12 at 20:00
  • @SteveIrwin No joy yet. I think ppumkin's update will work but I also think that I have an underlying permissions problem. I have a few things I am going to try before posting my success or dead end. I need this weekend to work on it as it has been a busy week. – Biff MaGriff Nov 09 '12 at 20:38

3 Answers3

6

You have to setup samba to allow anonymous/everyone/guest to be able to connect. This takes away the error message you.

This is deprecated ...

security = share
...
...
guest account = nobody

Use this instead

[global]
    workgroup = workgroup
    server string = MY-SERVER
    security = user
    map to guest = Bad User
    username map = /etc/samba/smbusers
    guest ok = yes

[to_password_protected_folder]
    path = /home/tom
    writeable = yes
    valid users = username1

[no_password_folder]
    path = /home/nobody
    writeable = yes

Possibly some other settings in the config need relaxing.. Samba in Linux is more secure than in Windows. The irony ... :-]

I hope that helps you.

Piotr Kula
  • 17,307
  • 6
  • 65
  • 104
1

I would suggest reconfiguring RPi and Samba using the setup shown here - http://www.megaleecher.net/Adding_External_USB_Disk_Drive_Storage_On_RasPi, this worked for me without any issues.

EnjoyThePi
  • 181
  • 1
  • 3
0

I was having this same problem, and was able to find a solution different from those posted above. I hope this is helpful to somebody else in a similar predicament

You mentioned that you were unable to change the permissions of the automounted folder - this is where the problem lies.

To fix, simply unmount the automounted drives by clicking the eject logo in the file explorer, or through the command line.

Then create a new folder in the media directory, I made mine "USBHDD1"

sudo mkdir /media/USBHDD1

Then mount the currently unmounted drive to this folder using

sudo mount -t auto /dev/sda1 /media/USBHDD1

Then you should be able to access the folder!