Results 1 to 9 of 9
Hello chaps,
I need to avoid as much as possible buying a router, so i read about, and come across this lovely program...iptables*
So, I follow the procedure defined @
...
- 01-27-2012 #1Just Joined!
- Join Date
- Sep 2008
- Posts
- 88
iptables-sav error
Hello chaps,
I need to avoid as much as possible buying a router, so i read about, and come across this lovely program...iptables*
So, I follow the procedure defined @and the first four commands are fine.HTML Code:https://help.ubuntu.com/community/Internet/ConnectionSharing
However, running the fifthgives me this error:Code:iptables-save |tree /etc/iptables.sav
Any ideas why? I'm doing it as root, an have tried in normal user mode.Code:/etc/iptables.sav [error opening dir]
Quick fix please...
- 01-28-2012 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,855
just by looking at the guide you linked, don't you mean to do this:
or if root, without the sudo parts:Code:sudo iptables-save | sudo tee /etc/iptables.sav
(you have tree)Code:iptables-save | tee /etc/iptables.sav
the next command fails b/c you did not create the file in the first command.
- 01-28-2012 #3Just Joined!
- Join Date
- Sep 2008
- Posts
- 88
I did create the file first, but the error recurred.
The full error is
What am I missing?Code:tree /etc/iptables.sav [error opening dir] 0 directories, 0 files
Last edited by njuguna; 01-28-2012 at 05:58 AM. Reason: add info
- 01-28-2012 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,855
this works perfectly for me:
Post the exact command you are running, and include any output the command generates.Code:user@localhost:~$ sudo iptables -A INPUT -i lo -j ACCEPT user@localhost:~$ sudo iptables-save |sudo tee /etc/iptables.sav # Generated by iptables-save v1.4.4 on Sat Jan 28 01:50:36 2012 *filter :INPUT ACCEPT [163:18309] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [76:7728] -A INPUT -i lo -j ACCEPT -A INPUT -i lo -j ACCEPT COMMIT # Completed on Sat Jan 28 01:50:36 2012 user@localhost:~$ cat /etc/iptables.sav # Generated by iptables-save v1.4.4 on Sat Jan 28 01:50:36 2012 *filter :INPUT ACCEPT [163:18309] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [76:7728] -A INPUT -i lo -j ACCEPT -A INPUT -i lo -j ACCEPT COMMIT # Completed on Sat Jan 28 01:50:36 2012 user@localhost:~$ sudo iptables-restore < /etc/iptables.sav user@localhost:~$ echo $? 0
- 01-31-2012 #5Just Joined!
- Join Date
- Sep 2008
- Posts
- 88
I'll do it shortly

Actually, I run the commands as they are above, and the only output I get is the error I posted above in full:
Code:tree /etc/iptables.sav [error opening dir] 0 directories, 0 files
Last edited by njuguna; 01-31-2012 at 05:20 AM.
- 01-31-2012 #6
Not my area, but I notice Atreyu's command is "sudo tee /etc/iptables.sav"
while yours is "tree /etc/iptables.sav". Change "tree" to "tee" and see if it runs.Registered Linux user #526930
- 01-31-2012 #7
- 01-31-2012 #8
From Wikipedia: In computing, tee is a command in various command-line interpreters (shells) such as Unix shells, 4DOS/4NT and Windows PowerShell, which displays or pipes the output of a command and copies it into a file or a variable. It is primarily used in conjunction with pipes and filters.
Contents
[hide]
1 Description and syntax
1.1 Unix-like
1.2 4DOS and 4NT
1.3 Windows PowerShell
2 Examples
2.1 Unix-like
2.2 4DOS and 4NT
2.3 Windows PowerShell
3 See also
4 References
5 External links
[edit] Description and syntax
tee is normally used to split the output of a program so that it can be seen on the display and also be saved in a file. The command can also be used to capture intermediate output before the data is altered by another command or program. The tee command reads standard input, then writes its content to standard output and simultaneously copies it into the specified file(s) or variables. The syntax differs depending on the command's implementation:Registered Linux user #526930
- 01-31-2012 #9Just Joined!
- Join Date
- Sep 2008
- Posts
- 88
Sorry atreyu, didn't post the exact command.
I see MASONTX, that the command was illegal because of the 'r' in 'tee' command.Code:iptables-save |tree /etc/iptables.sav
Thanks chaps.
That's the case, I'll give it a try tonight. Update you tomorrow.Last edited by njuguna; 01-31-2012 at 12:28 PM.


Reply With Quote
