LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-07-2012, 08:33 AM   #1
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Rep: Reputation: 16
Problems with permissions on mounted samba shares


I have a samba share that I've created on another Linux server. On the server I've set the owner and group with chown to root:root for all files.

On my laptop I'm operating under user myuser with uid 1000 and gid 1000. I successfully mount the samba share with the following:

Code:
sudo mount -t cifs -o username=root,password=root-password //myserver/ShareName /some/mountpoint
Now when I do 'ls -l /some/mountpoint' I see the files all listed with root for both owner and group. And when I try to do a simple 'touch /some/mountpoint/test', I get a 'Permission denied' error. But when I do 'sudo touch /some/mountpoint/test' it works. How can I make this work with my own 'myuser' account with uid 1000 and gid 1000 without having to take on root privileges (with sudo, su, or anything else)? I thought by entering the server's root credentials in the mount command it would be sufficient, but it seems not.

It seems like 'root' on the server and 'root' on the laptop are being treated the same here, which is confusing to me because I figured they would be different accounts because they're on different machines. If I change the file ownership on the server to a user whose uid doesn't exist on my laptop, doing 'ls -la' on the mounted samba share shows the ownership of that file to be a uid not a name, for example '501' or '502'. What happens in such a case where you mount a samba share with user ids that don't exist on the mounting system, I don't know much about this stuff but I would have assumed it would complain or not let you mount it!
 
Old 09-08-2012, 09:45 AM   #2
gdejonge
Member
 
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 285

Rep: Reputation: 70
Quote:
Originally Posted by veeruk101 View Post
It seems like 'root' on the server and 'root' on the laptop are being treated the same here, which is confusing to me because I figured they would be different accounts because they're on different machines. If I change the file ownership on the server to a user whose uid doesn't exist on my laptop, doing 'ls -la' on the mounted samba share shows the ownership of that file to be a uid not a name, for example '501' or '502'. What happens in such a case where you mount a samba share with user ids that don't exist on the mounting system, I don't know much about this stuff but I would have assumed it would complain or not let you mount it!
You are right, those two are different accounts. But remember that root always gets UID 0 no matter which system you work on, your client will always show root as owner.
Samba will only tell the client the UID and GID of a file on the share. The client will then look in his own /etc/passwd if it can map those values to a user name, if it can not it will just show the UID/GID it got from samba.

The mounting is done through the user/password you supply in the mount command. As long as they are valid the mount should succeed.

You could also take a look at man mount.cifs for more information on the options for mounting.

I also would advice to use a credentials file for the user and password.

For example, this is my fstab entry to mount my music colection.
Code:
//sirius/music     /home/gerrard/Music    cifs   cred=/etc/cred.gdj   0  0
A good place to learn more about samba is samba.org, especially the using samba documentation.

Last edited by gdejonge; 09-08-2012 at 09:56 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
samba shares permissions as flexible as 2003server shares? fdelval Linux - Newbie 5 11-23-2010 08:29 AM
problems with mounted samba shares v1pEr Linux - Software 4 06-15-2007 12:27 PM
Windows Shares Mounted in Samba, Best Way antidelldude Fedora 5 04-23-2007 01:58 PM
mounted samba shares disappear jsmarshall85 Suse/Novell 4 02-02-2005 02:49 PM
Problems with mounted Samba shares Fozza Linux - Software 1 12-09-2004 04:00 PM


All times are GMT -5. The time now is 01:19 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration