LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-23-2009, 03:15 AM   #1
nirmit
Member
 
Registered: Feb 2008
Posts: 73

Rep: Reputation: 15
file writting problem


hi,

i have one live server running Redhat 7.1. In this server i want to edit file hosts.deny. but i am not ablr to do so evenif i am a root user.

permission of that file is -rw-r--r-- , according to the permission i shoud be able to write the file but when ever i open file in vi and try to edit, it gives me a message that "attempting to change a readonly file" after doing changes i am closing file by :wq!. then also it is not writting the file.

so please help me to resolve it

Thanking You
Nirmit
 
Old 01-23-2009, 04:52 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Is it possible your partition is mounted read-only?

If so, to change anything on that partition you will need to remount it read-write:

Code:
mount -o remount,rw <partition>
When you are finished, you will likely (for security) want to remount it read-only:

Code:
mount -o remount,ro <partition>

<partition> would be the name of the partition containing /etc -- for example, something like /dev/hda5.

If you don't understand what I just said, please post the output of the mount command (without parameters).
 
Old 01-23-2009, 06:39 AM   #3
nirmit
Member
 
Registered: Feb 2008
Posts: 73

Original Poster
Rep: Reputation: 15
thank you for your reply..


but, i am able to edit hosts.allow file. only hosts.deny file is not editable. and i have to edit it.so plaese help me.
 
Old 01-23-2009, 06:44 AM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
try to change the permissions to 100644
 
Old 01-24-2009, 01:08 AM   #5
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Is it possible the immutables bit is set? (See chattr command.)


@repo

100644? What is that? When I try it on a test file (as expected) I get an error.
 
Old 01-24-2009, 04:09 AM   #6
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
@repo

100644? What is that? When I try it on a test file (as expected) I get an error.

should be 0644
 
Old 01-25-2009, 01:50 AM   #7
nirmit
Member
 
Registered: Feb 2008
Posts: 73

Original Poster
Rep: Reputation: 15
hi!thak you for the reply,

but the permission of the file is already -rw-r--r-- (0644).
 
Old 01-25-2009, 03:06 AM   #8
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
What is the output of

Code:
lsattr /etc/hosts.deny
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why a file writting command resulting an empty file? marhen Programming 9 05-05-2008 03:49 AM
Reading text file-writting binary file cdog Programming 5 06-13-2006 11:56 AM
writting to file in php blitzX Programming 2 01-16-2005 02:57 PM
Is a file in writting ? stephnane AIX 3 08-02-2004 11:17 PM
Is a file in writting stephnane Linux - General 2 07-30-2004 09:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:27 PM.

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