LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-09-2012, 07:01 AM   #1
srinivasanece
LQ Newbie
 
Registered: Mar 2012
Location: Komarapalayam,TamilNadu,INDIA
Distribution: CentOS,FreeBSD,RedHatLinux
Posts: 26

Rep: Reputation: Disabled
Exclamation Iptables Problem in RHEL5.1


Hi,

I got a linux box where when i try to save iptables


[1708][root@ssm:~]$service iptables save
Saving firewall rules to /etc/sysconfig/iptables: cp: cannot remove `/etc/sysconfig/iptables': Operation not permitted
[FAILED]


i get the error

Please help me in this issue....
 
Old 05-09-2012, 07:13 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Are you running this command as root?

What does "ls -l /etc/sysconfig/iptables" output?

What does "ls -ld /etc/sysconfig" output?

What does "ls -ld /etc" output?

What does "lsof /etc/sysconfig/iptables" output?

Typically what I do is:
cd /etc/sysconfig
cp -p iptables iptables.YYYYMMDD - This saves the current file to a date stamped copy.
iptables-save >iptables-save.YYMMDD - This saves the rules currently in memory to a date stamped copy.
I then make any changes to iptables desired then run:
iptables-save >iptables

I've never had an issue overwriting /etc/sysconfig/iptables so I'm not sure why you do unless you're not running as root or unless there is something odd about permissions or use on your system which is why I ask for the above output.
 
Old 05-09-2012, 09:00 AM   #3
srinivasanece
LQ Newbie
 
Registered: Mar 2012
Location: Komarapalayam,TamilNadu,INDIA
Distribution: CentOS,FreeBSD,RedHatLinux
Posts: 26

Original Poster
Rep: Reputation: Disabled
Exclamation

Quote:
Originally Posted by MensaWater View Post
Are you running this command as root?

What does "ls -l /etc/sysconfig/iptables" output?

What does "ls -ld /etc/sysconfig" output?

What does "ls -ld /etc" output?

What does "lsof /etc/sysconfig/iptables" output?

Typically what I do is:
cd /etc/sysconfig
cp -p iptables iptables.YYYYMMDD - This saves the current file to a date stamped copy.
iptables-save >iptables-save.YYMMDD - This saves the rules currently in memory to a date stamped copy.
I then make any changes to iptables desired then run:
iptables-save >iptables

I've never had an issue overwriting /etc/sysconfig/iptables so I'm not sure why you do unless you're not running as root or unless there is something odd about permissions or use on your system which is why I ask for the above output.
What does "ls -l /etc/sysconfig/iptables" output?-rw------- 1 root root 3897 Apr 26 14:42 /etc/sysconfig/iptables

What does "ls -ld /etc/sysconfig" output?drwxr-xr-x 10 root root 4096 May 9 16:51 /etc/sysconfig

What does "ls -ld /etc" output?drwxr-xr-x 102 root root 12288 May 7 11:45 /etc

What does "lsof /etc/sysconfig/iptables" output?nothing

pls help me
 
Old 05-09-2012, 09:06 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I don't see anything there that would prevent root from writing to iptables but you didn't answer the question I asked first: Are you logged in as root?

Type "who am i" and show output.

Type "whoami" and show output.

Also do NOT put "pls help" in your forum posts - if you're posting here it is understood as a request for assistance and adding the request for help annoys many people especially if you repeat it. Putting it at the end of your last post seems to imply my prior post was not an attempt to "help".
 
Old 05-09-2012, 08:21 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,623

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
seeing as there is a $
I would say that the OP is not
 
Old 05-09-2012, 08:49 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Code:
[1708][root@ssm:~]$service iptables save
Assuming the '$' is part of the prompt and not typed in, it may mean the OP used
Code:
su 

# instead of
su -
Also, could be SELinux; show
Code:
ls -lZ /etc/sysconfig/iptables

ls -lZd /etc/sysconfig

ls -lZd /etc

Last edited by chrism01; 05-10-2012 at 08:24 PM.
 
Old 05-09-2012, 11:31 PM   #7
srinivasanece
LQ Newbie
 
Registered: Mar 2012
Location: Komarapalayam,TamilNadu,INDIA
Distribution: CentOS,FreeBSD,RedHatLinux
Posts: 26

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by MensaWater View Post
I don't see anything there that would prevent root from writing to iptables but you didn't answer the question I asked first: Are you logged in as root?

Type "who am i" and show output.

Type "whoami" and show output.

Also do NOT put "pls help" in your forum posts - if you're posting here it is understood as a request for assistance and adding the request for help annoys many people especially if you repeat it. Putting it at the end of your last post seems to imply my prior post was not an attempt to "help".
yes i logged in as root....

Type "who am i" and show output srini pts/3 2012-05-10 09:38 (192.168.45.7)

Type "whoami" and show output. root
 
Old 05-09-2012, 11:33 PM   #8
srinivasanece
LQ Newbie
 
Registered: Mar 2012
Location: Komarapalayam,TamilNadu,INDIA
Distribution: CentOS,FreeBSD,RedHatLinux
Posts: 26

Original Poster
Rep: Reputation: Disabled
Exclamation

Quote:
Originally Posted by chrism01 View Post
Code:
[1708][root@ssm:~]$service iptables save
Assuming the '$' is part of the promt and not typed in, it may mean the OP used
Code:
su 

# instead of
su -
Also, could be SELinux; show
Code:
ls -lZ /etc/sysconfig/iptables

ls -lZd /etc/sysconfig

ls -lZd /etc
i used su -

SElinux disabled

ls -lZ /etc/sysconfig/iptables -rw------- root root /etc/sysconfig/iptables

ls -lZd /etc/sysconfig drwxr-xr-x root root system_ubject_r:etc_t:s0 /etc/sysconfig

ls -lZd /etc drwxr-xr-x root root system_ubject_r:etc_t:s0 /etc
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
static ( one to one ) natting issue in Iptables for RHEL5 ywaikul Linux - Security 6 02-24-2011 01:08 PM
Hello, This is my first post. - iptables status on RHel5 zapo Linux - Newbie 4 09-16-2009 06:47 PM
[SOLVED] Rather huge IPtables chain, iptables: Memory allocation problem. Gangrif Linux - Networking 10 09-11-2009 03:30 PM
Block Gtalk messenger using squid or iptables on RHEL5 linuxlover.chaitanya Linux - Server 5 08-10-2009 05:16 AM
iptables rules for RHEL5 & AD wegadnie Linux - Networking 3 07-20-2009 11:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:59 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