4

I have a bunch of files I want to share on my second internal drive.

I have file sharing off the primary (system) drive working file - Created a samba share user, and I can right-click on the folders I want to share and turn on sharing and it works.

But when I do the same thing off any folder on the secondary drive, it appears to work. Then when I try to access it over the network, the share appears, but upon connecting to the folder I get a message, "The operation can't be completed because the original item for 'ShareName' can't be found." Where 'ShareName' is the name of my share. That is on a OS/X box but I have similar problems when I try accessing it through my BluRay player (which on a previous install of Ubuntu could access the share just fine).

This question seems similar to mine but it has no answers: https://askubuntu.com/questions/111943/sharing-external-drive

I thought maybe it was because the drive was auto-mounted, so I added the following line to my fstab to no avail:

/dev/sda1 /media/StorageDrive ext4 rw,nosuid,nodev,uhelper=udisks 0 0

Then I thought it could be the mount permissions on my second HDD (since I am logging in remotely with an account specifically created for this):

drwx------ 6 mainuser  mainuser  4096 May  6 12:46 StorageDrive

But when I sudo chmod a+r StorageDrive it still doesn't work, despite the permissions changing for that mount session:

drwxr--r-- 6 mainuser  mainuser  4096 May  6 12:46 StorageDrive

Any thoughts?

Requested info

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   1.8T  0 disk 
└─sda1   8:1    0   1.8T  0 part /media/StorageDrive
sr0     11:0    1  1024M  0 rom  
sdb      8:16   0  83.9G  0 disk 
├─sdb1   8:17   0  71.9G  0 part /
├─sdb2   8:18   0     1K  0 part 
└─sdb5   8:21   0    12G  0 part [SWAP]

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=4f2a50b6-078a-4a7f-b194-db2f3d66a050 /               ext4    errors=remount-ro,user_xattr 0       1
# swap was on /dev/sda5 during installation
UUID=f7925973-e0e7-4b52-a449-0097230d4aa0 none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

# StorageDrive (UUID so it always identifies the right drive)
UUID="1fe509d8-f4d8-454d-83cc-b74bfb1f1731" /media/StorageDrive ext4 rw,nosuid,nodev,uhelper=udisks,gid=media 0 0

2 Answers2

2

Having just wasted 40% of my rep on a bounty for this, I believe it might be permissions after all. Setting permissions to:

drwxr--r-- 6 media media 4096 May  6 12:46 StorageDrive

appears to have made the share work. media is a group with users mainuser,media and media is the user that I'm logging in to the share with.

So now I just need to make this permanent in the fstab while not granting access to the entire drive to the media user (other than the sub-sub-directory where the media files are stored).

  • Ha, thanks. If only I could transfer rep from SO. :-) – Ari B. Friedman May 10 '12 at 17:29
  • In my opinion, change file system permissions to get Samba to behave correctly is just being lazy when there is most likely a good Samba configuration that would accomplish what you need. – djangofan May 16 '12 at 18:11
0

You could probably accomplish it with a config similar to this, which isn't necessarily secure, but it demonstrates that CHMOD is most likely not necessary :

## smb.conf file
...
security = share 
guest account = publicuser
passdb backend = tdbsam
...

[extshare]
comment = External Share
path = /media/mountpoint
public = yes
writable = yes
write list = +publicuser
browseable = yes
hosts allow = 192.168.10.10

And /etc/samba/smbusers file:

# Unix_name = SMB_name1 SMB_name2 ...
# root = 
publicuser = Administrator smbguest pcguest guest
# nobody = guest pcguest smbguest
djangofan
  • 3,714