| Red Hat This forum is for the discussion of Red Hat Linux. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-04-2004, 01:45 PM
|
#1
|
|
LQ Newbie
Registered: Apr 2003
Distribution: Slackware
Posts: 10
Rep:
|
cannot edit file as root with write permissions set?
NOTE: This is on a Redhat ES 2.1 Server
I am very, very confused. The file is a ColdFusion file in /home/httpd/www. I have permissions to edit the file.
[root@www www]# ls -lah Stuff.cfm
-rw-rw-r-- 1 mike mike 7.4k Jul 23 15:31 Stuff.cfm
The file system is also mounted as read-write.
[root@www www]# mount
/dev/cciss/c0d0p9 on / type ext3 (rw)
none on /proc type proc (rw)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
/dev/cciss/c0d0p1 on /boot type ext3 (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/cciss/c0d0p5 on /home type ext3 (rw)
/dev/cciss/c0d0p2 on /home/httpd type ext3 (rw)
/dev/cciss/c0d0p8 on /opt type ext3 (rw)
/dev/cciss/c0d0p10 on /tmp type ext3 (rw)
/dev/cciss/c0d0p3 on /usr type ext3 (rw)
/dev/cciss/c0d0p7 on /var type ext3 (rw)
But I can't edit the file, when I open and do an insert operation in vi I get:
-- INSERT -- W10: Warning: Changing a readonly file
And when I try to save the file anyways with wq! I get:
"Stuff.cfm" E212: Can't open file for writing
Hit ENTER or type command to continue
Any clue what in the hell is going on? I didn't set this system up, I've inherited it. After some testing I've found that /etc/passwd and /etc/shadow do the same exact thing, even though I can edit them with root on seperate installations. Can't edit with PICO either. Hell, I can't even chmod the file:
[root@www www]# chmod +w ProgViewFundingOps.cfm
chmod: changing permissions of `ProgViewFundingOps.cfm': Operation not permitted
Last edited by Mishley; 08-04-2004 at 01:47 PM.
|
|
|
|
08-05-2004, 03:08 AM
|
#2
|
|
Member
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 987
Rep:
|
Quote:
[root@www www]# ls -lah Stuff.cfm
-rw-rw-r-- 1 mike mike 7.4k Jul 23 15:31 Stuff.cfm
|
You are logged in as root, not as mike. That file is writeable only by user or group 'mike', not 'root.
-------------------------------------
Sorry, too hasty. root can edit any file, I then have no clue as to what is causing this.
Last edited by pingu; 08-05-2004 at 03:11 AM.
|
|
|
|
08-05-2004, 09:48 AM
|
#3
|
|
LQ Newbie
Registered: Apr 2003
Distribution: Slackware
Posts: 10
Original Poster
Rep:
|
Yeah I know root can edit any file which is why I was really confused, but I found the problem. The file was using "chattr" as a secondary file system to place a lock on the file. The file was set to immutable.
[root@www www]# lsattr Stuff.cfm
---i---------- Stuff.cfm
So I tried to change it using chattr, but it didn't work.
[root@www www]# chattr -i Stuff.cfm
[root@www www]# lsattr Stuff.cfm
---i---------- Stuff.cfm
I then went and checked the history of the various accounts (I inherited this box so I was looking for a clue) and found the cr command, which may be a custom command for Redhat ES 2.1 or may be something that the administrator built in to prevent someone from knowing how to properly change the file attributes.
[root@www www]# cr -i Stuff.cfm
[root@www www]# lsattr Stuff.cfm
-------------- Stuff.cfm
The file was then editable. To put back the immutable status I used chattr, though cr also worked for some reason. Again, I suspect this was obfuscation on the part of the admin.
[root@www www]# cr +i Stuff.cfm
[root@www www]# lsattr Stuff.cfm
---i---------- Stuff.cfm
[root@www www]# cr -i Stuff.cfm
[root@www www]# chattr +i Stuff.cfm
[root@www www]# lsattr Stuff.cfm
---i---------- Stuff.cfm
So now everyone is happy. Once I removed immutable from the file I was able to edit it fine. Thanks for your help, and I hope this helps someone else.
|
|
|
|
08-05-2004, 10:10 AM
|
#4
|
|
Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
Quote:
Originally posted by Mishley
I hope this helps someone else.
|
it already started helping people!!
thanks!!
=)
by the way, i'm a little curious about why you haven't made your own install, as every linux user i know would be way too paranoid as to actually trust someone else's install...
have you checked the install for rootkits??
http://www.rootkit.nl
=)
|
|
|
|
08-05-2004, 12:23 PM
|
#5
|
|
LQ Newbie
Registered: Apr 2003
Distribution: Slackware
Posts: 10
Original Poster
Rep:
|
I'm just admin-ing this box for him while he's on vacation, but couldn't get in touch with him to find out what he had done.
Rest assured if it was MY box it would be running Debian  .
I'm glad it helped. I couldn't find ANYTHING on this for like two days on Google, which is why I thought it would be a good idea to post a detailed account of what I had found.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:23 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|