LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 11-19-2008, 09:43 PM   #1
vonedaddy
Member
 
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 180

Rep: Reputation: 17
Setting permissions on a Share


I have a fedora box running in my office. A friend who works in the same building was nice enough to set up a samba share on his PC so I can share all his music, media, etc.
The problem is I have a couple different people using my linux computer and I would hate for one of them to accidentally erase his files, or even use them without his permission.

I was wondering if I can setup permissions on the mount point or something. So only I can access the share.

Now keep in mind I am fairly savy but not really a linux guru by any means.

Here is how he has me mounting it in my /etc/fstab:

//studio/drobo /drobo cifs username=savone,password=********,uid=500,gid=500 0 0

(Password removed for obvious reasons)

When I try to set the permissions on the the /drobo directory I get permission denied, even while root.

So how can I make it so only I (user savone) use these files?
 
Old 11-20-2008, 02:52 PM   #2
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
Here's an old snippet I like to reference from something I once did. If your fstab is readable by users, they can get your password. That's why I recommend the credentials file.

Code:
//patsy/psc    /home/psc/smb    smbfs    uid=1000,gid=100,credentials=/root/patsy  0  0
where:
uid 1000 = user 'psc'
gid 100 = group 'users'

now the file /root/patsy contains:
Code:
username = psc
password = mypass
and has permissions 400 for root:root


-- That point you in the right direction?
 
Old 11-20-2008, 04:32 PM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,541
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Or you could setup user accounts on your system along with the before mentioned security suggestions.
 
Old 11-21-2008, 12:05 AM   #4
vonedaddy
Member
 
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 180

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by secesh View Post
Here's an old snippet I like to reference from something I once did. If your fstab is readable by users, they can get your password. That's why I recommend the credentials file.

Code:
//patsy/psc    /home/psc/smb    smbfs    uid=1000,gid=100,credentials=/root/patsy  0  0
where:
uid 1000 = user 'psc'
gid 100 = group 'users'

now the file /root/patsy contains:
Code:
username = psc
password = mypass
and has permissions 400 for root:root


-- That point you in the right direction?

You lost me a little with the uid and user pcs.

Should I use the uid of the user who should have access to the mounted share?

also what group should I be using in place of the gid 100 you have here?
 
Old 11-21-2008, 07:14 AM   #5
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
Don't read too much into what I posted. I copied/pasted an example which you should modify to your needs. Yes -- use the UID of the user on the local system who should have access. Change the GID to your personal group (if you have uid 1000, you likely have gid 1000). You can cat /etc/passwd and /etc/group to see this info. Where I listed 'psc' above, you should have 'savone'.

Also, I took a look at "man 8 mount.cifs" and see that you might be interested in file_mode and dir_mode. I have modified your original fstab line to what I think would work (If you setup the credentials file. Otherwise put your user/pass back in)

Code:
//studio/drobo /drobo cifs credentials=/root/drobo,uid=500,gid=500,file_mode=0750,dir_mode=0750 0 0
 
Old 11-21-2008, 12:10 PM   #6
vonedaddy
Member
 
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 180

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by secesh View Post
Don't read too much into what I posted. I copied/pasted an example which you should modify to your needs. Yes -- use the UID of the user on the local system who should have access. Change the GID to your personal group (if you have uid 1000, you likely have gid 1000). You can cat /etc/passwd and /etc/group to see this info. Where I listed 'psc' above, you should have 'savone'.

Also, I took a look at "man 8 mount.cifs" and see that you might be interested in file_mode and dir_mode. I have modified your original fstab line to what I think would work (If you setup the credentials file. Otherwise put your user/pass back in)

Code:
//studio/drobo /drobo cifs credentials=/root/drobo,uid=500,gid=500,file_mode=0750,dir_mode=0750 0 0
THANK YOU so much for your help, I just wanted to make sure you know how appreciative I am.

So this worked out great. I did look at the man page but it seems you have to already KNOW the terminology to be able to understand those man pages. Thanks to your help I learned a great deal and have the permissions I wanted on the share. I really appreciate you sticking with me through it.
 
Old 11-21-2008, 12:14 PM   #7
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
Cheers. Glad to know I helped - thanks for the bump.
 
Old 11-21-2008, 01:57 PM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,541
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Quote:
Originally Posted by vonedaddy View Post
THANK YOU so much for your help, I just wanted to make sure you know how appreciative I am.

So this worked out great. I did look at the man page but it seems you have to already KNOW the terminology to be able to understand those man pages. Thanks to your help I learned a great deal and have the permissions I wanted on the share. I really appreciate you sticking with me through it.
Look at the next 4 links especially the last two in my sig to assist you in understanding;
 
Old 11-21-2008, 05:35 PM   #9
vonedaddy
Member
 
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 180

Original Poster
Rep: Reputation: 17
Just for the hell of it (if anyone else finds this thread useful to them) I made some changes that worked out great.

I created a new group mp3users which had a gid of 505

I changed the fstab line a bit so I can easily give read access to that share to other users by assigning them the secondary group mp3users.

//studio/drobo /drobo cifs credentials=/root/drobo,uid=500,gid=505,file_mode=0750,dir_mode=0750 0 0

now the share has permissions for rwx for me (uid 500) and read for the group mp3users. Anyone I assign to the group mp3users will have read access to the mp3 but can not delete or write to any of the directories.

Thanks again.
 
  


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 Share Help (Permissions) carlosinfl Linux - Server 2 02-08-2008 08:36 AM
Permissions on a Share Server? carlosinfl Linux - Server 4 11-20-2007 02:11 PM
setting permissions for samba share eagle63 Linux - Newbie 2 12-23-2005 09:53 PM
File share permissions squib Linux - Newbie 1 09-21-2004 10:45 PM
I need help setting samba share permissions. trilect Linux - Software 10 08-24-2004 08:56 AM


All times are GMT -5. The time now is 04:21 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration