Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-23-2003, 09:59 AM   #1
Registered: Aug 2003
Posts: 59

Rep: Reputation: 15
Question Permissions question

Can root always do anything with any file? Is it possible for the root user to lock himself out of a file, unable to access it or change its permissions back?
Old 09-23-2003, 10:11 AM   #2
Senior Member
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
i had a somewhat similiar question a few months back, but it was related to editing the /etc/passwd file and resetting the roots password....and i thought it was a major flaw, so i asked how can this be avoided and here is the answer i got :
There are ways to keep anyone from overwritting current files or even appending to them, one way:
chattr +i
On the file. Root cannot even append to the file if this is applied. You will have to:
chattr -i
To remove that restriction to actually change the files. It's a quick and easy thing to do to:

Just remember you did it should you choose to. This is obviously un-doable should one gain root access, but this will keep them from gaining root access an easier way.
so i would assume chattr +i would stop the root and anyone else from doing anything to a file, and in turn lock them out...
Old 09-23-2003, 10:16 AM   #3
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 67
Root will always have permission to change permissions so this should never happen. It is possible to write protect a fiel to the root user but you will be able to change the permissions back.
Old 09-23-2003, 10:55 AM   #4
Registered: Feb 2003
Location: San Antonio
Distribution: Suse 9.0 Professional
Posts: 843

Rep: Reputation: 30
You can make it so that root can't accidentally delete or update a file, which is what I have done for some files, however, in vi, when I really want to
Esc:w! will override the current permissions.


P.S. But accidentally hosing your system is the #1 reason not to run as root. Well, maybe tied for #1 with security risk if you are on the internet. See Mr Ross' sig, well, don't try that as root unless you really want to re-install your OS or want to see just how long it takes your box to die.
Six simple characters on the command line. Now that is power!


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
Question about permissions UnforgotteN Linux - Distributions 6 05-18-2005 08:51 PM
Permissions question: what does the Thaidog Linux - General 7 03-29-2005 10:16 PM
Permissions question... phil1076 Linux - General 3 09-03-2003 10:50 AM
Permissions Question? gsmonk Linux - General 3 08-27-2003 03:30 PM
Permissions Question jkraeger Linux - General 1 02-25-2003 10:54 AM > Forums > Linux Forums > Linux - Newbie

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