Re: "Interesting" Samba issue [Solved]

Connection sharing, Firewall, Samba..etc
Forum rules
Before you post please read this

Re: "Interesting" Samba issue [Solved]

Postby Mr Green Genes on Fri Jan 25, 2013 11:34 am

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 Mr Green Genes on Tue Jan 29, 2013 10:43 am, edited 1 time in total.
Things are not always as they seem.
Mr Green Genes
Level 1
Level 1
 
Posts: 12
Joined: Thu Jan 24, 2013 5:11 pm
Location: Wiltshire, England

Linux Mint is funded by ads and donations.
 

Re: "Interesting" Samba issue

Postby kwisher on Fri Jan 25, 2013 8:32 pm

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.
The instructions suggested Windows XP or better, so I installed Linux :)
User avatar
kwisher
Level 5
Level 5
 
Posts: 624
Joined: Wed Mar 05, 2008 12:54 pm
Location: Greentown, Indiana USA

Re: "Interesting" Samba issue

Postby altair4 on Sat Jan 26, 2013 8:51 am

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.
altair4
Level 15
Level 15
 
Posts: 5507
Joined: Tue Feb 03, 2009 10:27 am

Re: "Interesting" Samba issue

Postby kwisher on Sat Jan 26, 2013 3:35 pm

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.
The instructions suggested Windows XP or better, so I installed Linux :)
User avatar
kwisher
Level 5
Level 5
 
Posts: 624
Joined: Wed Mar 05, 2008 12:54 pm
Location: Greentown, Indiana USA

Re: "Interesting" Samba issue

Postby altair4 on Sat Jan 26, 2013 5:29 pm

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.
altair4
Level 15
Level 15
 
Posts: 5507
Joined: Tue Feb 03, 2009 10:27 am

Re: "Interesting" Samba issue

Postby Mr Green Genes on Sun Jan 27, 2013 7:52 am

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.
Things are not always as they seem.
Mr Green Genes
Level 1
Level 1
 
Posts: 12
Joined: Thu Jan 24, 2013 5:11 pm
Location: Wiltshire, England

Re: "Interesting" Samba issue

Postby Mr Green Genes on Tue Jan 29, 2013 10:41 am

Bingo!! I moved the mount point and all is now good. Thanks again.
Things are not always as they seem.
Mr Green Genes
Level 1
Level 1
 
Posts: 12
Joined: Thu Jan 24, 2013 5:11 pm
Location: Wiltshire, England

Linux Mint is funded by ads and donations.
 

Return to Other networking topics

Who is online

Users browsing this forum: No registered users and 4 guests