<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Send Remote Commands Via SSH</title>
	<atom:link href="http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/feed" rel="self" type="application/rss+xml" />
	<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html</link>
	<description>Big, Honkin' Systems Stuff</description>
	<lastBuildDate>Sun, 29 Apr 2012 08:52:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: systemsboy</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-3728</link>
		<dc:creator>systemsboy</dc:creator>
		<pubDate>Thu, 16 Feb 2012 14:30:28 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-3728</guid>
		<description>I&#039;m not sure it&#039;s possible to do what you&#039;re trying to do, but I&#039;m pretty sure it won&#039;t work with this method. The method described in this post is for sending shell commands to remote UNIX-type machines.

-systemsboy</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure it&#8217;s possible to do what you&#8217;re trying to do, but I&#8217;m pretty sure it won&#8217;t work with this method. The method described in this post is for sending shell commands to remote UNIX-type machines.</p>
<p>-systemsboy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ramesh</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-3727</link>
		<dc:creator>ramesh</dc:creator>
		<pubDate>Thu, 16 Feb 2012 13:08:52 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-3727</guid>
		<description>hi!..i am not able to execute commands when logged into another system using command prompt programatically…
i am writing commands in C# and executing on command prompt. after logging into other system the commands are not executing in windows environment using shell script</description>
		<content:encoded><![CDATA[<p>hi!..i am not able to execute commands when logged into another system using command prompt programatically…<br />
i am writing commands in C# and executing on command prompt. after logging into other system the commands are not executing in windows environment using shell script</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ramesh</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-3726</link>
		<dc:creator>ramesh</dc:creator>
		<pubDate>Thu, 16 Feb 2012 12:59:15 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-3726</guid>
		<description>hi!..i am not able to execute commands when logged into another system using command prompt programatically...
i am writing commands in C3 and executing on command prompt. after logging into other system the commands are not executing</description>
		<content:encoded><![CDATA[<p>hi!..i am not able to execute commands when logged into another system using command prompt programatically&#8230;<br />
i am writing commands in C3 and executing on command prompt. after logging into other system the commands are not executing</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: systemsboy</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-3493</link>
		<dc:creator>systemsboy</dc:creator>
		<pubDate>Fri, 25 Nov 2011 18:55:22 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-3493</guid>
		<description>I&#039;m unable to replicate the behavior you&#039;re describing, from a Mac SSHing to multiple clients both Mac and Linux. It sounds like the user is set up correctly, but you might check the user&#039;s environment settings on the remote machine.

You could also take a look at the SSH config. There are two files to check:
/etc/ssh_config
/etc/sshd_config

Look for anything in those files that might be preventing standard (non-root) users from issuing remote commands or that might mess with command paths.

FYI, I&#039;m using the standard settings with no modifications.

Also:
man ssh
man ssh_config
man sshd_config

Might provide clues.

-systemsboy</description>
		<content:encoded><![CDATA[<p>I&#8217;m unable to replicate the behavior you&#8217;re describing, from a Mac SSHing to multiple clients both Mac and Linux. It sounds like the user is set up correctly, but you might check the user&#8217;s environment settings on the remote machine.</p>
<p>You could also take a look at the SSH config. There are two files to check:<br />
/etc/ssh_config<br />
/etc/sshd_config</p>
<p>Look for anything in those files that might be preventing standard (non-root) users from issuing remote commands or that might mess with command paths.</p>
<p>FYI, I&#8217;m using the standard settings with no modifications.</p>
<p>Also:<br />
man ssh<br />
man ssh_config<br />
man sshd_config</p>
<p>Might provide clues.</p>
<p>-systemsboy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-3491</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 25 Nov 2011 12:25:38 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-3491</guid>
		<description>Hi i tried this command as ...
ssh username@ip ls ... it says ls not found
if i login using ssh and then type ls it works ... also if i try it with root as in
ssh root@ip ls it works fine .... Can anyone tell me if any configuration or permission needs to be added in order to make a user work

thanks in advance</description>
		<content:encoded><![CDATA[<p>Hi i tried this command as &#8230;<br />
ssh username@ip ls &#8230; it says ls not found<br />
if i login using ssh and then type ls it works &#8230; also if i try it with root as in<br />
ssh root@ip ls it works fine &#8230;. Can anyone tell me if any configuration or permission needs to be added in order to make a user work</p>
<p>thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: systemsboy</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-2974</link>
		<dc:creator>systemsboy</dc:creator>
		<pubDate>Tue, 30 Aug 2011 12:44:46 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-2974</guid>
		<description>Not exactly sure what you want to do, surendra. Can you give me more information? What path are you trying to change? What are you ultimately trying to achieve?

You are showing me the sshd_config file, which is for configuring the SSH daemon, not user properties.

If you want to change the user&#039;s home directory, you&#039;d do that in /etc/passwd, I believe (Linux experts correct me if I&#039;m wrong).

-systemsboy</description>
		<content:encoded><![CDATA[<p>Not exactly sure what you want to do, surendra. Can you give me more information? What path are you trying to change? What are you ultimately trying to achieve?</p>
<p>You are showing me the sshd_config file, which is for configuring the SSH daemon, not user properties.</p>
<p>If you want to change the user&#8217;s home directory, you&#8217;d do that in /etc/passwd, I believe (Linux experts correct me if I&#8217;m wrong).</p>
<p>-systemsboy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: surendra</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-2973</link>
		<dc:creator>surendra</dc:creator>
		<pubDate>Tue, 30 Aug 2011 11:31:45 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-2973</guid>
		<description>hi this is surendra

i have ssh ftp configure

in my server one user is there 

/home/services/DAILY
how can i put path
linux centos5 

#	$OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

#PATH=/home/services/DAILY

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.

#Port 22
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile	.ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don&#039;t trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
#59.90.131.411
# Don&#039;t read the user&#039;s ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes

# Set this to &#039;yes&#039; to enable PAM authentication, account processing, 
# and session processing. If this is enabled, PAM authentication will 
# be allowed through the ChallengeResponseAuthentication mechanism. 
# Depending on your PAM configuration, this may bypass the setting of 
# PasswordAuthentication, PermitEmptyPasswords, and 
# &quot;PermitRootLogin without-password&quot;. If you just want the PAM account and 
# session checks to run without PAM authentication, then enable this but set 
# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes

# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 
AcceptEnv LC_IDENTIFICATION LC_ALL
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

# no default banner path
Banner /home/services/DAILY

# override default of no subsystems
Subsystem	sftp	/usr/libexec/openssh/sftp-server</description>
		<content:encoded><![CDATA[<p>hi this is surendra</p>
<p>i have ssh ftp configure</p>
<p>in my server one user is there </p>
<p>/home/services/DAILY<br />
how can i put path<br />
linux centos5 </p>
<p>#	$OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $</p>
<p># This is the sshd server system-wide configuration file.  See<br />
# sshd_config(5) for more information.</p>
<p>#PATH=/home/services/DAILY</p>
<p># The strategy used for options in the default sshd_config shipped with<br />
# OpenSSH is to specify options with their default value where<br />
# possible, but leave them commented.  Uncommented options change a<br />
# default value.</p>
<p>#Port 22<br />
#Protocol 2,1<br />
Protocol 2<br />
#AddressFamily any<br />
#ListenAddress 0.0.0.0<br />
#ListenAddress ::</p>
<p># HostKey for protocol version 1<br />
#HostKey /etc/ssh/ssh_host_key<br />
# HostKeys for protocol version 2<br />
#HostKey /etc/ssh/ssh_host_rsa_key<br />
#HostKey /etc/ssh/ssh_host_dsa_key</p>
<p># Lifetime and size of ephemeral version 1 server key<br />
#KeyRegenerationInterval 1h<br />
#ServerKeyBits 768</p>
<p># Logging<br />
# obsoletes QuietMode and FascistLogging<br />
#SyslogFacility AUTH<br />
SyslogFacility AUTHPRIV<br />
#LogLevel INFO</p>
<p># Authentication:</p>
<p>#LoginGraceTime 2m<br />
#PermitRootLogin yes<br />
#StrictModes yes<br />
#MaxAuthTries 6</p>
<p>#RSAAuthentication yes<br />
#PubkeyAuthentication yes<br />
#AuthorizedKeysFile	.ssh/authorized_keys</p>
<p># For this to work you will also need host keys in /etc/ssh/ssh_known_hosts<br />
#RhostsRSAAuthentication no<br />
# similar for protocol version 2<br />
#HostbasedAuthentication no<br />
# Change to yes if you don&#8217;t trust ~/.ssh/known_hosts for<br />
# RhostsRSAAuthentication and HostbasedAuthentication<br />
#IgnoreUserKnownHosts no<br />
#59.90.131.411<br />
# Don&#8217;t read the user&#8217;s ~/.rhosts and ~/.shosts files<br />
#IgnoreRhosts yes</p>
<p># To disable tunneled clear text passwords, change to no here!<br />
#PasswordAuthentication yes<br />
#PermitEmptyPasswords no<br />
PasswordAuthentication yes</p>
<p># Change to no to disable s/key passwords<br />
#ChallengeResponseAuthentication yes<br />
ChallengeResponseAuthentication no</p>
<p># Kerberos options<br />
#KerberosAuthentication no<br />
#KerberosOrLocalPasswd yes<br />
#KerberosTicketCleanup yes<br />
#KerberosGetAFSToken no</p>
<p># GSSAPI options<br />
#GSSAPIAuthentication no<br />
GSSAPIAuthentication yes<br />
#GSSAPICleanupCredentials yes<br />
GSSAPICleanupCredentials yes</p>
<p># Set this to &#8216;yes&#8217; to enable PAM authentication, account processing,<br />
# and session processing. If this is enabled, PAM authentication will<br />
# be allowed through the ChallengeResponseAuthentication mechanism.<br />
# Depending on your PAM configuration, this may bypass the setting of<br />
# PasswordAuthentication, PermitEmptyPasswords, and<br />
# &#8220;PermitRootLogin without-password&#8221;. If you just want the PAM account and<br />
# session checks to run without PAM authentication, then enable this but set<br />
# ChallengeResponseAuthentication=no<br />
#UsePAM no<br />
UsePAM yes</p>
<p># Accept locale-related environment variables<br />
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES<br />
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT<br />
AcceptEnv LC_IDENTIFICATION LC_ALL<br />
#AllowTcpForwarding yes<br />
#GatewayPorts no<br />
#X11Forwarding no<br />
X11Forwarding yes<br />
#X11DisplayOffset 10<br />
#X11UseLocalhost yes<br />
#PrintMotd yes<br />
#PrintLastLog yes<br />
#TCPKeepAlive yes<br />
#UseLogin no<br />
#UsePrivilegeSeparation yes<br />
#PermitUserEnvironment no<br />
#Compression delayed<br />
#ClientAliveInterval 0<br />
#ClientAliveCountMax 3<br />
#ShowPatchLevel no<br />
#UseDNS yes<br />
#PidFile /var/run/sshd.pid<br />
#MaxStartups 10<br />
#PermitTunnel no<br />
#ChrootDirectory none</p>
<p># no default banner path<br />
Banner /home/services/DAILY</p>
<p># override default of no subsystems<br />
Subsystem	sftp	/usr/libexec/openssh/sftp-server</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Butch</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-2853</link>
		<dc:creator>Butch</dc:creator>
		<pubDate>Sun, 14 Aug 2011 13:28:04 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-2853</guid>
		<description>@linux_newbie8478

On the note of the ssh timeout, you could precede every command with a netcat sequence to see if the host is accessible.  Something like:
nc -z hostname 22 -w 2

If you get the string &quot;Success!&quot; the server is up and accepting connections on port 22, the return code will (should) be 0.  If the server doesn&#039;t respond it will time out after 2 seconds and the return code will (should) be 1.  

Maybe use an if statement inside your for loop?  (example is written in BASH)
for i in ${serverList[@]};
do
nc -z -w 2 $i 22; 
if [ $? == 0 ];
then ssh $i &#039;uptime&#039; &gt;&gt; uptime.log;
else echo &quot;Host is down&quot; &gt;&gt; error.log;
fi
done

This will almost do what it looks like you wanted.  Adapting it for Python shouldn&#039;t be difficult, but I did it with BASH as that is what I&#039;m most fluent with.  It needs some clean up for things like hostnames in the uptime and error logs and such, but should help provide some direction.

Also if you setup ssh keys then you wont have to worry about entering the password every time.</description>
		<content:encoded><![CDATA[<p>@linux_newbie8478</p>
<p>On the note of the ssh timeout, you could precede every command with a netcat sequence to see if the host is accessible.  Something like:<br />
nc -z hostname 22 -w 2</p>
<p>If you get the string &#8220;Success!&#8221; the server is up and accepting connections on port 22, the return code will (should) be 0.  If the server doesn&#8217;t respond it will time out after 2 seconds and the return code will (should) be 1.  </p>
<p>Maybe use an if statement inside your for loop?  (example is written in BASH)<br />
for i in ${serverList[@]};<br />
do<br />
nc -z -w 2 $i 22;<br />
if [ $? == 0 ];<br />
then ssh $i &#8216;uptime&#8217; &gt;&gt; uptime.log;<br />
else echo &#8220;Host is down&#8221; &gt;&gt; error.log;<br />
fi<br />
done</p>
<p>This will almost do what it looks like you wanted.  Adapting it for Python shouldn&#8217;t be difficult, but I did it with BASH as that is what I&#8217;m most fluent with.  It needs some clean up for things like hostnames in the uptime and error logs and such, but should help provide some direction.</p>
<p>Also if you setup ssh keys then you wont have to worry about entering the password every time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SSH Executing Remote Commands &#124; bryanstamour.com</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-1680</link>
		<dc:creator>SSH Executing Remote Commands &#124; bryanstamour.com</dc:creator>
		<pubDate>Sun, 27 Jun 2010 17:15:08 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-1680</guid>
		<description>[...] you can pass the -t flag to ssh. I didn&#8217;t know this before, I found out today while reading systemsboy&#8217;s [...]</description>
		<content:encoded><![CDATA[<p>[...] you can pass the -t flag to ssh. I didn&#8217;t know this before, I found out today while reading systemsboy&#8217;s [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: davessh -p 8222 smtp1.sound-i.co.uk 'screen -rd'</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-1620</link>
		<dc:creator>davessh -p 8222 smtp1.sound-i.co.uk 'screen -rd'</dc:creator>
		<pubDate>Mon, 24 May 2010 17:26:35 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-1620</guid>
		<description>silky, i use the -t to reattach my screen session once ssh has connected (using keyless logins). Moist, now i can run one command, connect to my chat server and reattach my screen so my irc stays connected permantly. Nice!!</description>
		<content:encoded><![CDATA[<p>silky, i use the -t to reattach my screen session once ssh has connected (using keyless logins). Moist, now i can run one command, connect to my chat server and reattach my screen so my irc stays connected permantly. Nice!!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/13 queries in 0.009 seconds using disk: basic
Object Caching 366/366 objects using disk: basic

Served from: systemsboy.com @ 2012-05-18 11:26:01 -->
