LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 06-15-2011, 08:05 AM   #1
pandunr
LQ Newbie
 
Registered: May 2011
Posts: 12

Rep: Reputation: Disabled
Create the file, write into that file but can't delete file in Linux


Is it possible to set up permision on the file such owner can create the file & write into that but can not delete file.

Immediate answer highly appreciated
 
Old 06-15-2011, 08:08 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Yes. Deleting files is dependent on the directory's permissions. So if you set "~/folder" to be read-only, then you can't delete any files inside "~/folder", and if you then set "~/folder/file" to have write permissions, you will have a file that can be written to but not deleted
 
Old 06-15-2011, 08:11 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Yes:
Code:
root@CW8:/tmp# touch dir/test.file
root@CW8:/tmp# chown c:users dir/test.file
c@CW8:/tmp/dir$ echo xxx > test.file 
c@CW8:/tmp/dir$ rm test.file
rm: cannot remove `test.file': Permission denied
 
Old 06-15-2011, 08:45 AM   #4
Randeep
LQ Newbie
 
Registered: Apr 2010
Location: Bangalore
Distribution: Redhat, Centos
Posts: 25

Rep: Reputation: 0
Or you can set chattr

chattr +i /path_to_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
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
Linux shell command for makefile.in to create a text file and write to it alix123 Programming 8 01-07-2005 08:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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