LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 08-05-2003, 02:47 PM   #1
hopbalt
Member
 
Registered: Jul 2003
Posts: 39

Rep: Reputation: 15
How do you chmod a file that is -r--------?


If I login as root, how do I edit this file?
 
Old 08-05-2003, 02:50 PM   #2
tangle
Senior Member
 
Registered: Apr 2002
Location: Smithville, TN
Distribution: Slackware
Posts: 1,745

Rep: Reputation: 71
chmod 700
 
Old 08-05-2003, 03:23 PM   #3
hopbalt
Member
 
Registered: Jul 2003
Posts: 39

Original Poster
Rep: Reputation: 15
So even though the file permissions specifically state that root can only read the file, its still possible to edit the file so that root can do the other stuff too?

that seems contradictory to me. I guess the file permissions dont apply if you are logged in as root
 
Old 08-05-2003, 05:41 PM   #4
redhax8
Member
 
Registered: Jan 2002
Distribution: Debian
Posts: 43

Rep: Reputation: 15
If the permissions are -r-------- then root can only read the file, not write to it. If you do a chmod 700 as tangle said the permissions will now be -rwx------ so the owner of the file and root can read, write to, or, if it is a script, execute it.
 
Old 08-05-2003, 06:32 PM   #5
sub_slack
Member
 
Registered: Jul 2003
Distribution: slackware
Posts: 56

Rep: Reputation: 15
> If the permissions are -r-------- then root can only read the file, not write to it

root can do whatever he wants
 
Old 08-05-2003, 06:45 PM   #6
Skyline
Senior Member
 
Registered: Jun 2003
Distribution: Debian/other
Posts: 2,104

Rep: Reputation: 45
Quote:
If the permissions are -r-------- then root can only read the file, not write to it. If you do a chmod 700 as tangle said the permissions will now be -rwx------ so the owner of the file and root can read, write to, or, if it is a script, execute it.
Root user can write to anything - have a look at this.

Use a

chmod 400 filename


to create this permission pattern on an ordinary users file.

-r--------

(check it with ls -l filename)

Then - log in as Root user and you'll find you can write to the file as Root user , even considering the permission pattern and the owner.

Last edited by Skyline; 08-05-2003 at 06:48 PM.
 
Old 08-05-2003, 06:48 PM   #7
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Root can at least always change the permissions so he can do anything.
But I've noticed things like apache files only being accessable by the user apache until I'd alter permissions or change user.
 
  


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
chmod won't change the file permissions midtown266 Linux - Newbie 12 11-28-2004 08:46 PM
using chmod to change file permission kiwidoc Linux - Newbie 3 07-25-2004 07:39 AM
chmod 755 won't change file permission. duffboygrim Linux - General 11 04-29-2004 07:17 PM
chmod and file permissions help qages Linux - General 5 01-27-2003 07:08 AM
file perm, chgrp, chmod, and umask Martini Linux - Newbie 2 08-06-2002 09:04 PM

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

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