Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 02-26-2008, 04:25 AM   #1
Registered: Oct 2004
Posts: 69

Rep: Reputation: 15
Lock a files in Linux

Hi Folks

Could you tell me how do I lock a file in Linux? Which means, chmod or rm of root user also operation not permitted.

Anybody know how to do that?

Old 02-26-2008, 04:35 AM   #2
Simon Bridge
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Can root create a file which even root cannot modify? This, in different forms, is a question that has puzzles theists and people of such ilk through the ages.

See this, last panel.

Presumably chmod 0000 filename will do it. But I am reluctant to try... I like being able to modify files. Why would anyone even want to try this?
Old 02-26-2008, 10:10 AM   #3
Registered: Oct 2004
Posts: 69

Original Poster
Rep: Reputation: 15
No, it is not chmod change to 0000 because you are not permitted even is root user. I wonder know because my files disappear unconsciously. But my superior can "lock" the files even root user cannot chmod or rm.

Thus I wondering how he do that to "lock" file? I am thinking that inode. Could any body give the info?

Old 02-26-2008, 10:29 AM   #4
LQ Guru
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 6,311

Rep: Reputation: Disabled
Extended attributes allow to do this by setting immutable flag. See man attr.

Edit: man chattr for EXT filesystem.

Last edited by Emerson; 02-26-2008 at 10:32 AM.
Old 02-27-2008, 06:45 AM   #5
Registered: May 2001
Posts: 29,362
Blog Entries: 55

Rep: Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548
@Lewk: since your FUP question wasn't about Linux Security, and LQ likes you to create a new thread for questions that have no bearing on your OP, I've pruned it. It now lives at


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 tell Samba not to lock files ? digimike Linux - Networking 11 01-29-2009 03:55 PM
Is it possible to not have lock files? rsmccain Linux - General 3 10-20-2006 12:29 PM
Cleaning up flock lock files. cyent Programming 1 08-14-2006 09:20 PM
can't get samba to lock files dgermann Linux - Networking 17 03-29-2006 08:08 PM
How to Lock Files (/etc/passwd /var/spool/[user] Larry James Programming 3 12-04-2000 11:06 AM > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:41 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration