Re: "Interesting" Samba issue [Solved]

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Mr Green Genes

Re: "Interesting" Samba issue [Solved]

Post by Mr Green Genes »

I have spent several frustrating hours trying to get my laptop to access a new drive on my server via Samba. I eventually found a work around but I'm not sure whether the problem is a bug or a feature so I'd like some advice.

My new drive is mounted at /media/user/data1 on the server. I made /data1 shareable and set permissions so everyone could do everything, for testing. The laptop could see it but couldn't mount it, whatever I did. The fix was to make /media shareable instead. I'm unclear as to why my original idea didn't work and would appreciate a bit of feedback.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
kwisher

Re: "Interesting" Samba issue

Post by kwisher »

I am assuming you already had Samba working correctly before you installed the new drive or are starting a Samba server from scratch? I share numerous folders from the /media folder and apply the permissions to the specific folders, ie /media/digital-pics.
altair4
Level 20
Level 20
Posts: 11427
Joined: Tue Feb 03, 2009 10:27 am

Re: "Interesting" Samba issue

Post by altair4 »

I can't think of anything that explains your symptoms ... unless you are using Mint14.

In the olden days if you mounted things to /media/LABEL and changed permissions to 777 everything worked as expected. /media would be at 755, /media/LABEL would be at 777, and everyone and your Aunt Tilly would have access.

Today, if you mount things to /media/$USER/LABEL things get a little complicated because the developers decided to over think the plumbing. /media is still at 755 so there's no change there but take a look at /media/$USER:
$ ls -dl /media/altair
drwxr-x---+ 3 root root 4096 Jan 26 07:29 /media/altair
That doesn't look good does it. At first sight it looks like only root will have access to the directory until you see that "+" at the end. It's using Access Control Lists to determine who has access:
$ getfacl /media/altair
getfacl: Removing leading '/' from absolute path names
# file: media/altair
# owner: root
# group: root
user::rwx
user:altair:r-x
group::---
mask::r-x
other::---
Altair is the only user ( aside from root ) who has permissions to access the directory so you can either add a "force user = altair" to your share definition which will convert the samba client to the only user who can access the contents of the directory or move the mount point to /media/LABEL and restore things to the way it used to be.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
kwisher

Re: "Interesting" Samba issue

Post by kwisher »

altair4 wrote:I can't think of anything that explains your symptoms ... unless you are using Mint14.

In the olden days if you mounted things to /media/LABEL and changed permissions to 777 everything worked as expected. /media would be at 755, /media/LABEL would be at 777, and everyone and your Aunt Tilly would have access.

Today, if you mount things to /media/$USER/LABEL things get a little complicated because the developers decided to over think the plumbing. /media is still at 755 so there's no change there but take a look at /media/$USER:
$ ls -dl /media/altair
drwxr-x---+ 3 root root 4096 Jan 26 07:29 /media/altair
That doesn't look good does it. At first sight it looks like only root will have access to the directory until you see that "+" at the end. It's using Access Control Lists to determine who has access:
$ getfacl /media/altair
getfacl: Removing leading '/' from absolute path names
# file: media/altair
# owner: root
# group: root
user::rwx
user:altair:r-x
group::---
mask::r-x
other::---
Altair is the only user ( aside from root ) who has permissions to access the directory so you can either add a "force user = altair" to your share definition which will convert the samba client to the only user who can access the contents of the directory or move the mount point to /media/LABEL and restore things to the way it used to be.
altair, can't you add your samba users to the users group and change the ownership to altair:users? That's how I do mine and then I let samba handle the user permissions on the share.
altair4
Level 20
Level 20
Posts: 11427
Joined: Tue Feb 03, 2009 10:27 am

Re: "Interesting" Samba issue

Post by altair4 »

altair, can't you add your samba users to the users group and change the ownership to altair:users? That's how I do mine and then I let samba handle the user permissions on the share.
You can do that plus any number of other things as long as you move the mount point to /media/XXX or anywhere other than under /media/$USER.

And just to be clear, this is a Mint14 / Ubuntu 12.10 phenomenon. If you are using Mint13 and want to create a mountpoint at /media/altair/XXX then you can set it to 777 or do what you suggested and everything works as it always has. Do that on Mint14 and /media/altair will stop you because it's under the control of that directories ACL. MInt14 creates a /media/$USER directory for all local users automatically and applies the corresponding ACL to that folder.

You might be tempted to override the ACL but lord know what was in their minds when they came up with this idea and what impact such a change would mean. For my money I think it was an attempt to make all temporary mounts regardless of how they were formatted have the same access restrictions as if you plugged in an NTFS usb device in earlier versions. In Mint14 when you plug in an ext4 usb device it automounts to /media/$USER/LABEL with /media/$USER having owner = $USER and permissions of 700. /media/$USER/LABEL could have perms = 777 but it won't matter because only one user will get to it.

I am making a big assumption when I posted my original answer that the OP was using Mint14 basing it on his mount point of /media/user/data1. Most folks don't have a mountpoint like that but Mint14 will do that automatically.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Mr Green Genes

Re: "Interesting" Samba issue

Post by Mr Green Genes »

Thanks to all.

Altair, yes, I am using Mint 14, a fresh installation on a new machine. Samba did work ok with the one drive supplied with it but my bizarre problem occured when I put the new drive in a day or so later. I will be trying what you suggest and will post back when I've done that.
Mr Green Genes

Re: "Interesting" Samba issue

Post by Mr Green Genes »

Bingo!! I moved the mount point and all is now good. Thanks again.
Locked

Return to “Networking”