LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-20-2010, 11:19 PM   #1
neteng996
LQ Newbie
 
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0
remote ssh issue with the iptables command


Hi. I'm trying to remote ssh into a server and get and iptables listing. I'm using this:

results=`ssh -q -l root remoteserver "iptables -nvL;"`
echo $results

My results show the first line of the remote server's iptables and half way thru the line I get a local directory listing and then the last portion of the remote iptables line. This will repeat until I have seen all of the rules within iptables.

If I remove the "v" so it looks like "iptables -nL;" I get back my normal iptables rules as expected.

Any suggestions?

Last edited by neteng996; 09-20-2010 at 11:47 PM.
 
Old 09-21-2010, 11:05 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,417
Blog Entries: 55

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
Note that if you issue the same command on a machine you get entries with asterisks in them. Those get interpreted by the shell (that's why you see local directory listings) and they need to be escaped. What's worse is that you allow root access over SSH. That is not a good practice and completely unnecessary for just passively listing things: see Xinetd (script an entry with "server I= /sbin/iptables" and "server_args = --line-numbers -nxvL"), SNMP, CGI or even netcat could do.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
Fedora 10/unable to ssh out from box to remote host (SSH within LAN ok) huskeypm Linux - Networking 3 04-14-2009 07:37 PM
SSH - Remote aplications in remote server Urien Linux - Newbie 11 04-04-2009 04:02 AM
Remote login with SSH, but display on remote computer. brodin Linux - Software 3 09-09-2007 03:01 AM
ssh issue: /usr/bin/ssh -x -oFallBackToRsh no -l WeNdeL Linux - Software 1 03-04-2003 07:17 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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