LinuxQuestions.org
Visit Jeremy's Blog.
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 08-09-2004, 04:42 AM   #1
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Rep: Reputation: 32
Lightbulb Samba Directory Trick


I am running samba on my LAN. I have a guest directory which is readable and writable by everyone.

I want to do something on this directory and that is;

I want the users only to write and read in this directory , but they should not be able to delete any file from this directory.

i.e; If a user has created a file in this directory then he should not be able to delete or replace it.

someone has told me that you have to do something with "umask" but I don't know how ?
He told me that when a file is created you should change the "umask" to change its permssion, if you know something like that then please tell me.

Please tell me how it is possible?
 
Old 08-09-2004, 05:52 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
The “umask” is a bitmap that sets the access properties for a file (or directory). You can use it to say if a given file can be read from (= directory contents listed), written to (=new files created) or executed (= directory contents can be accessed).

Each one of these can be set independantly for just one user, just one group, or everyone else.

First cd to the directory in question.
Code:
cd (directory)
Assuming that the files are created by group “user”, what you want to do is make the files read/writable to the user group:
Code:
chmod g=r *
The asterisk means “everything in this directory.” You can check this with
Code:
ls -l
(you want something like -***rw-*** where * can be anything).

Every file will then be marked as read-only and cannot be changed.

There's probably a way to set the default umask for new files, so you don't have to keep running this all the time.

Hope that helps,

— Robert J. Lee
 
Old 08-09-2004, 09:45 AM   #3
Sagara Sanosuke
LQ Newbie
 
Registered: Jun 2004
Location: Texas, US
Distribution: Mandrake 8.2
Posts: 9

Rep: Reputation: 0
I believe what you're asking for a the command ' create mode ' in samba. Goto to your smb.conf file and add ' create mode = XXXX ' where XXXX is the permissions you want to assign to the file. For example ' create mode = 0750 '.
 
Old 08-09-2004, 12:59 PM   #4
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
but by doing this we cannot change the contents of the file cause it is readable but as the directory has "-rwxrwxrwx /tmp " option so we can still delete the file.
I want that once a file is created in the /tmp directory it should not be deleted.
"Remember I am asking this question for Samba not for local working"
 
Old 08-09-2004, 01:50 PM   #5
jdelaros1
LQ Newbie
 
Registered: Sep 2003
Location: Austin, TX USA
Distribution: Fedora 1.0, 2.0 & SuSE 9.2
Posts: 20

Rep: Reputation: 0
I don't believe there's a Linux command (umask, chmod, etc) you can use to set this up. If a user can create a file, then he/she should be able to delete it. It is possible to set up an existing directory with existing files that users can write to (but not delete) but they won't be able to create a file either.

Remember that if a user can write to a file, he/she can delete all the contents of a file and save the empty file, wouldn't this be the same as deleting the file altogether?

Are you using a specialized file server? A NetApp appliance perhaps? You could probably use a setting in it to prevent you from deleting files no matter what, regardless of what the file/dir Linux permissions tell you.
 
  


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
Can't delete a directory with samba mortalic Linux - Networking 7 12-21-2010 12:03 AM
Samba, LDAP, NIS. Which one does the trick? GD_19 Linux - Networking 2 06-23-2005 01:56 AM
Novell E-Directory Available to SAMBA treedstang Linux - General 1 02-23-2005 05:19 PM
Can not write to SAMBA directory nairnie Linux - Networking 8 11-21-2003 07:58 PM
Samba directory problem... chuck77 Linux - General 5 01-17-2002 08:54 PM

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

All times are GMT -5. The time now is 01:18 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