Iptables command won't work
Hi,
I have iptables installed but the command "iptables" doesn't do anything. All I get is bash: iptables: command not found, which seems a little odd to me. I am sure that I have iptables installed and have tried to configure it will webmin but I think something went wrong. Can anyone help me recover this please? Thanks, James |
Hi James,
Bash is telling you it couldn't find iptables. So, or if it is not installed or it is not on your path. Iptables is generally installed on /usr/sbin; if you are trying to execute it from a normal user, probably you won't find it. Good luck! Osvaldo. |
What kernel are you using?
iptables should be in /usr/sbin/iptables, have you checked with whereis iptables? You may need to modprobe iptables if you have it compiled as a module and it does not load on boot. |
Hi guys,
Thanks for your quick responses. I tried #whereis iptables and got iptables: /sbin/iptables /lib/iptables /usr/share/man/man8/iptables.8.gz I am a newbie to this area of linux and don't understand what you mean by "You may need to modprobe iptables if you have it compiled as a module and it does not load on boot." Could it be that I have made a mess of the configuration files and now it won't start? thanks, James |
also. I am using Fedora Core 2 which I think it kernel 2.4. Is there a shell command to tell this?
|
Do this /sbin/iptables -h
That should work. You have iptables in /sbin/ which is not in your $PATH, it shouldn't be if you are not root. Are you sure that you have been root when you have been trying to access iptables? Cause iptables requires root access. |
Just tried /sbin/iptables -h and it displayed a list of instructions :) Now I have /sbin/ in front of the commands it seems to work. The /sbin/iptables command and /sbin/iptables --list command work.
Should I update my $PATH and if so do you know how I should do this? thanks, James |
Are you sure that you are root when trying? Because here is the thing. /sbin is "super-user bin" and it is a dir with programs only for root, therefor root should have it in $PATH but a regular user should not. Whoever you are you can check you $PATH with echo $PATH.
Here is how you change $PATH. Edit /root/.bashrc and add this line: Code:
export PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH |
I am certain that I am the su. Firstly if says root and second there is # which I assume also means root.
So on echo $path I got nothing at all. just a blank line. Should i be worried? Anyhow I will try you code to change this. James |
Hi James,
If you're doing from kde and maybe gnome, you won't have /sbin and /usr/sbin in your path. It would be different in text mode. Osvaldo. P.S. PATH must be in upper case letters. |
All times are GMT -5. The time now is 06:31 PM. |