Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a Raspberry Pi (though could be any Debian Linux box) connected to an external hard disk formatted as NTFS.

My disk mount in fstab is:

/dev/sda1 /media/disk  ntfs-3g  defaults,uid=1000,gid-1000,dmask=007,fmask=007  0  0

where user 1000 is the 'pi' user

/media/disk/shared is my Samba root folder. Must be accessible from Windows and Mac

Now, I can see the share in Windows, but I get permission denied. If I try mapping a drive to it, and attempt login using \machinename\pi the login fails.

Any ideas?

Edit-- smb.conf below. I've removed all comment lines (I assume lines beginning # or ; are comments)

[global]

   workgroup = WORKGROUP
   server string = %h server
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   encrypt passwords = true
   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

[shared]
   comment = Ali and Greg Shared Folders
   writeable = yes
   public = yes
   browseable = yes
   path = /media/disk/shared
   guest only = yes
   guest ok = yes

   read only = no

   create mask = 0777
   directory mask = 0777

[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no

[hdd]
   comment = Samba server's HDD
   read only = no
   locking = no
   path = /media/disk/shared
   guest ok = yes
share|improve this question
    
Did you add the users to the Samba password database using smbpasswd -a? Samba does not authenticate against /etc/shadow && /etc/passwd. See http://www.samba.org/samba/docs/man/manpages-3/smbpasswd.8.html. –  Sean C. Oct 1 '12 at 19:12
    
More confused! I tried smbpasswd. Still couldn't connect. Created a new share. Still couldn't connect. Messed with various Windows (8) file sharing and network discovery settings. It starts working on the new share (but not the old one). I then one by one change all the Windows settings back to what they were, expecting the share to stop working... it still works. I will try to redo this server from scratch from my notes and figure this out. But not tonight! Thanks for the suggestion though. –  Greg Woods Oct 1 '12 at 20:21
    
In smb.conf, the share that works is /media/disk, the share that doesn't is /media/disk/shared. Both have the same permissions. –  Greg Woods Oct 1 '12 at 20:30
    
Attempting to connect from a second Windows 7 PC failed. I go back to the partially working Windows 8 PC, and now that fails to connect on both shares. I have changed nothing on the Debian box. This is too random. I am beyond help. Will start from scratch :( –  Greg Woods Oct 2 '12 at 9:49
    
Could you please post the contents of your smb.conf file? –  Sean C. Oct 2 '12 at 13:06
show 4 more comments

2 Answers

up vote 0 down vote accepted

Here's my configuration and it works:

[public]
comment = Public Storage
path = /media/hddusb
create mask = 0660
directory mask = 0771
read only = no
guest ok = yes
browseable = yes
share|improve this answer
    
This works for me, provided my fstab mount point is set up with no security at all (mask permissions of 000). I had to work that bit out for myself :) –  Greg Woods Oct 3 '12 at 21:05
    
I commented on my own post below before I read this. I'm glad you got it worked out. –  Sean C. Oct 4 '12 at 11:12
add comment

From 0 to Samba on RaspberryPi (Debian)!

root@raspberrypi:/var/log# uname -a
Linux raspberrypi 3.1.9+ #272 PREEMPT Tue Aug 7 22:51:44 BST 2012 armv6l GNU/Linux
root@raspberrypi:/var/log# cat /etc/issue
Debian GNU/Linux wheezy/sid \n \l

This works for me on my Pi. The smb.conf is 8 lines (not counting the blank). I've connected with both Mac OSX and Windows 7 clients without issue using the username testme with password set to testme. You could literally paste this line for line other than setting the passwords.

##the REQUIRED smbpasswd is part of samba-common-bin -- YOU MUST EXPLICITY SELECT IT
aptitude install samba samba-common-bin
mkdir -p /data/share
chmod 1777 /data/share
cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

cat > /etc/samba/smb.conf << "EOF"
workgroup = workgroup
netbios name = rpi
encrypt passwords = yes

[share]
path = /data/share
read only = no
browseable = yes
valid users = testme
EOF

useradd -s /bin/bash -d /home/testme -m testme
passwd testme ##set password
smbpasswd -a testme ##set same password; this is used for samba authentication

/etc/init.d/samba restart

### DONE!! ###
share|improve this answer
    
Tried that. I can still see the share in Windows, but cannot open it. How is the testme user granted access to the mounted folder which has owner 'pi'? From what I can tell, the masks in my fstab only allow owner and group access to the disk. –  Greg Woods Oct 3 '12 at 20:24
1  
I would remove /etc/fstab from the equation, and even NTFS for the moment. Mount a local directory as a samba share. If that works, mount the NTFS share with a simple mount command which, devoid of fstab, accepts the default options. I plugged in a NTFS formatted disk, mounted it with mount -t ntfs /dev/sdb1 /mnt/ntfs and then shared it out with samba without issue. –  Sean C. Oct 4 '12 at 11:09
    
Now I've changed to using 'permissions' instead of 'defaults' in my fstab mount, your method using smbpasswd works perfectly. Thanks –  Greg Woods Oct 5 '12 at 17:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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