LinuxQuestions.org
Help answer threads with 0 replies.
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 05-09-2012, 04:29 AM   #1
micro_xii
Member
 
Registered: Sep 2006
Posts: 140

Rep: Reputation: 15
allowed to create/edit a file but not to DELETE A FILE.


greetings;

centos 6

I command this chmod o+rwx /folder. From my xp I can access \\server\folder, create and delete into this file.

But how to provide permission where he can create/edit a file BUT RESTRICTED TO DELETE A FILE.
In windows this can be done in advnce security how about in linux?

Any ideas guys...pls help..
 
Old 05-09-2012, 04:55 AM   #2
em31amit
Member
 
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190

Rep: Reputation: 55
seems you are referening here a stick bit permission, use chmod 1777 /folder


else you need to play with acl's and selinux policy to prevent this.
 
Old 05-09-2012, 08:12 PM   #3
micro_xii
Member
 
Registered: Sep 2006
Posts: 140

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by em31amit View Post
seems you are referening here a stick bit permission, use chmod 1777 /folder


else you need to play with acl's and selinux policy to prevent this.
Hello, Thanks for the reply. I've search and command this:

setfacl -m u:linix:rwx /folder

But doesn't solved my problem. I want read,write, execute BUT RESTRICT TO DELETE A FILE.

can anyone help me...tnx in advance
 
Old 05-09-2012, 08:31 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
You may be able to do it via Samba cfg, but in *nix, creating/deleting a file is a write operation on the dir inode, not the file.
I don't think *nix perms or even ACLs is going to do it.
Sticky bit only prevents others from deleting a file you create; it can't stop you deleting a file you created.
 
Old 05-09-2012, 09:05 PM   #5
micro_xii
Member
 
Registered: Sep 2006
Posts: 140

Original Poster
Rep: Reputation: 15
Now, I get it..sticky bit prevents others from deleting your files except the owner/creator.

By the way, your referring samba cfg, what exactly do i need to look for? coz i dont see *cfg in /etc/samba. Can you just give me tips to start with.

thnx..
 
Old 05-09-2012, 09:57 PM   #6
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,500

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
Quote:
Originally Posted by chrism01 View Post
You may be able to do it via Samba cfg, but in *nix, creating/deleting a file is a write operation on the dir inode, not the file.
I don't think *nix perms or even ACLs is going to do it.
Sticky bit only prevents others from deleting a file you create; it can't stop you deleting a file you created.
So doesn't that mean that setting write restrictions on the directory does exactly that? Enable to write the file, but not to delete it. I recall that I had this problems (in conjunction with Samba) where I could not delete files.

jlinkels
 
Old 05-10-2012, 01:14 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
You need write access on the dir to create file (in that dir) and also to delete one; they both count as write ops on the dir inode/file itself. There's no delete perm in *nix, unlike eg OpenVMS.
I think(?) you can get what you want if you go via a Samba/cifs cxn; check the Samba docs.
 
Old 05-10-2012, 02:19 AM   #8
em31amit
Member
 
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190

Rep: Reputation: 55
have you tried to set chattr on files ?


setting +a (append only attributes to files can helps you to append the data but not to delete or rename file)

but still only root can set these attributes .


lsattr /path/to/file #to show the extended attributes

chattr +a /path/to/file #TO change


Thanks,
em31amit
Amit m.
 
Old 05-10-2012, 05:00 AM   #9
micro_xii
Member
 
Registered: Sep 2006
Posts: 140

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by chrism01 View Post
You need write access on the dir to create file (in that dir) and also to delete one; they both count as write ops on the dir inode/file itself. There's no delete perm in *nix, unlike eg OpenVMS.
I think(?) you can get what you want if you go via a Samba/cifs cxn; check the Samba docs.

This are what i command:

note: centos is joined in win2003

1. chmod 1070 /folder
2. under my samba..
directory mask = 0770
create mask = 0770


drwxr-xr-x. 2 nixuser domain users 4096 May 10 16:24 nix1 (folder nix1 created in centos)
drwxrwx---. 2 xpuser domain users 4096 May 10 16:29 win1 (folder win1 created in windows)

base on the problem i raise, the sticky bit answered my question only owners can create/delete their own file..done

the issue right now is creating/editing between folders..

Maybe this is a good start for me...I really dont know if im going the right way
 
Old 05-10-2012, 07:22 PM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
If Samba won't do it, you may have to resort to dir monitoring eg dnotify/fam and call a script to move the completed file to another area where the dir perms are r-x only.
Alternately, use a code ctrl system eg cvs, subversion etc.
 
  


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
Create the file, write into that file but can't delete file in Linux pandunr Linux - Newbie 3 06-15-2011 08:45 AM
create, edit, or view a file in Linux Harmain Linux - Newbie 5 10-05-2009 08:05 PM
[SOLVED] Need help create a bash script to edit CSV File imkornhulio Programming 13 02-05-2009 10:23 AM
Edit words to upper case without delete anything from source file cgcamal Programming 9 01-17-2009 06:06 AM
text match pipe to file then delete from original text file create new dir automatic tr1px Linux - Newbie 6 09-10-2008 09:40 PM


All times are GMT -5. The time now is 10:56 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration