LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-12-2009, 05:44 PM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
Is there a way to specify append only permissions for a file?


Is there a way to specify append only permissions for a file?

TIA
 
Old 09-12-2009, 09:46 PM   #2
tommylovell
Member
 
Registered: Nov 2005
Distribution: Raspbian, Debian, Ubuntu
Posts: 380

Rep: Reputation: 103Reputation: 103
If your filesystem is ext2/3, you can set the 'a' extended attribute using the chattr command.

From the chattr man page:
Quote:
A file with the ‘a’ attribute set can only be open in append mode for writing. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
That'll prevent a file from being opened for output but won't automatically change it to append (that is, it won't change an fopen's mode from 'w' to 'a', it'll just prevent the file from being overwritten).
 
Old 09-12-2009, 09:52 PM   #3
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by tommylovell View Post
If your filesystem is ext2/3, you can set the 'a' extended attribute using the chattr command.

From the chattr man page:


That'll prevent a file from being opened for output but won't automatically change it to append (that is, it won't change an fopen's mode from 'w' to 'a', it'll just prevent the file from being overwritten).
EXACTLY WHAT I NEEDED!!

I am using this for the .bash_history files for underprivileged users.
 
  


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
how to append contents of one file to another existing file amit_pansuria Programming 1 11-17-2008 10:01 AM
Append file ust Linux - Newbie 2 11-06-2008 09:51 PM
how to append columns form a column file in another file adam_blackice Programming 4 09-17-2007 11:33 PM
[Perl] append to new file noir911 Programming 5 02-08-2007 06:38 AM
append to file d-rez Linux - Newbie 2 06-20-2002 04:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:26 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
Open Source Consulting | Domain Registration