LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-08-2003, 12:53 AM   #1
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Rep: Reputation: 30
samba question


hi all

in samba how do i set the permisions so that the file/dir is writeable but not deletable

thanks
 
Old 05-09-2003, 12:19 AM   #2
Sutekh
Member
 
Registered: Apr 2002
Location: Melbourne, Australia
Distribution: Gentoo
Posts: 273

Rep: Reputation: 30
the samba permissions are basically unix permissions so if you can write you can delete
 
Old 05-09-2003, 03:12 PM   #3
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Rep: Reputation: 32
if you are using ext2 or ext3 check chattr +u filename
 
Old 05-22-2003, 11:43 PM   #4
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Original Poster
Rep: Reputation: 30
thanks all but i got a bettr option

here it is

chmod -R 1777 <directory>

this will make the directory readable,wireable,executable to user,group,others but they will not be able to delete it
 
Old 05-22-2003, 11:50 PM   #5
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Original Poster
Rep: Reputation: 30
but i have another problem when i create a subdirectory within the main directory for which i have set the above perms i am able to delete it, it does not get the same permissions

what should i do for that

thanks


regards
jayakrishnan
 
Old 05-23-2003, 03:11 AM   #6
Sutekh
Member
 
Registered: Apr 2002
Location: Melbourne, Australia
Distribution: Gentoo
Posts: 273

Rep: Reputation: 30
good point, forgot the sticky bit!

anyway you should be able to set the smb.conf options

directory mask = 1777
create mask = 1777
force user=root

to acheive this effect.

AFAIK the sticky bit allows only the ownder of the directory to delete it so in this case if you created it you could delete it, but no one else could. The above force user option means all files/dir's are created as if from that user so use root or some other uid that is not normally used.
 
Old 05-23-2003, 03:44 AM   #7
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Original Poster
Rep: Reputation: 30
thanks suketh
 
Old 05-23-2003, 04:04 AM   #8
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Original Poster
Rep: Reputation: 30


I added the those statements to my smb.conf file but the user is able to delete the file/directory, even though the full permissions
have been set

rwxrwxrwt




the user nad group of the file is root
 
Old 05-23-2003, 04:08 AM   #9
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Original Poster
Rep: Reputation: 30
AFAIK

force user=root

connects to the server as a root user, that means the connecting user has the full perms
 
Old 05-23-2003, 04:21 AM   #10
Sutekh
Member
 
Registered: Apr 2002
Location: Melbourne, Australia
Distribution: Gentoo
Posts: 273

Rep: Reputation: 30
oops so it does, I had never used it and hadn't really thought that through. I guess you could run a script to change the owner or each directory and put the script into cron but that is a bit kludgey, besides it is possible for the directory to be quickly created and deleted in this way anyway. I will have to have a closer look
 
Old 06-01-2003, 04:01 AM   #11
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Original Poster
Rep: Reputation: 30
Hi

can some one help me with this


regards
jayakrishnan
 
Old 06-01-2003, 06:53 AM   #12
gupi
LQ Newbie
 
Registered: Mar 2003
Location: RO-Timisoara
Distribution: RH8; RH9; LinuxFromScratch
Posts: 10

Rep: Reputation: 0
The answer is closer than you think!

Quote:
force create mode (S)

This parameter specifies a set of UNIX mode bit permissions that will always be set on a file created by Samba. This is done by bitwise 'OR'ing these bits onto the mode bits of a file that is being created or having its permissions changed. The default for this parameter is (in octal) 000. The modes in this parameter are bitwise 'OR'ed onto the file mode after the mask set in the create mask parameter is applied.

See also the parameter create mask for details on masking mode bits on files.

See also the inherit permissions parameter.

Default: force create mode = 000

Example: force create mode = 0755

would force all created files to have read and execute permissions set for 'group' and 'other' as well as the read/write/execute bits set for the 'user'.
Now all you have to do is take a closer look at the smb.conf(5) man page
 
Old 06-01-2003, 08:20 AM   #13
Sutekh
Member
 
Registered: Apr 2002
Location: Melbourne, Australia
Distribution: Gentoo
Posts: 273

Rep: Reputation: 30
gupi,

the problem is that the user that owns the directory/file has write permission and therefore can delete, this is the original problem jayakrishnan was trying to get around. We have already discussed useing the create mask's to set the sticky bit but this still does not help if the person trying to delete owns the file.
 
  


Reply



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 smb.config question (quick question) TheDOGG Linux - Networking 1 03-02-2004 07:19 AM
Samba question Ryknow215 Linux - General 3 02-23-2004 06:11 PM
Samba question Marklar Linux - Networking 30 01-02-2004 03:44 PM
A Samba Question? gsmonk Linux - Networking 2 08-20-2003 09:14 AM
RE: Samba question pls help {Newbie question} Radiouk Linux - Networking 4 06-03-2002 06:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:08 PM.

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
Open Source Consulting | Domain Registration