<?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>Mon, 09 Jan 2012 19:19:37 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<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>
	<item>
		<title>By: Jussi</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-1588</link>
		<dc:creator>Jussi</dc:creator>
		<pubDate>Mon, 03 May 2010 07:55:36 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-1588</guid>
		<description>@systemsboy and @Razi:
One scenario where you would like to have behaviour like described is when you would like to attach to a remote screen automatically (with for example &quot;screen -dr&quot;) but would also like to later detach the screen to be able to do something else on the server. 

If the run command is only &quot;screen -dr&quot; the detaching from the screen session would also log you out. Ouch. I personally use &quot;screen -dr &amp;&amp; bash -i&quot; as the command to run. It&#039;s not the most beautiful approach but seems to work.

Why do I want it? I run screen+irssi on a remote server. Whenever my internet connection breaks for long enough time for the ssh session to break, I want to be able to reconnect and be ready for IRC business as  soon as possible with as little hassle as possible :)</description>
		<content:encoded><![CDATA[<p>@systemsboy and @Razi:<br />
One scenario where you would like to have behaviour like described is when you would like to attach to a remote screen automatically (with for example &#8220;screen -dr&#8221;) but would also like to later detach the screen to be able to do something else on the server. </p>
<p>If the run command is only &#8220;screen -dr&#8221; the detaching from the screen session would also log you out. Ouch. I personally use &#8220;screen -dr &amp;&amp; bash -i&#8221; as the command to run. It&#8217;s not the most beautiful approach but seems to work.</p>
<p>Why do I want it? I run screen+irssi on a remote server. Whenever my internet connection breaks for long enough time for the ssh session to break, I want to be able to reconnect and be ready for IRC business as  soon as possible with as little hassle as possible <img src='http://systemsboy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/comment-page-1#comment-436</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Wed, 30 Jul 2008 22:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-436</guid>
		<description>With openssh you can set a ConnectTimeout... &lt;br/&gt;ssh -o ConnectTimeout=8 blah blah&lt;br/&gt;&lt;br/&gt;Timeout is in seconds.</description>
		<content:encoded><![CDATA[<p>With openssh you can set a ConnectTimeout&#8230; <br />ssh -o ConnectTimeout=8 blah blah</p>
<p>Timeout is in seconds.</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-435</link>
		<dc:creator>systemsboy</dc:creator>
		<pubDate>Tue, 01 Jul 2008 23:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/#comment-435</guid>
		<description>Razi,&lt;br/&gt;&lt;br/&gt;The end of the command should not log you out of the Terminal. It should only log you out of the machine you&#039;re SSHing to. If you don&#039;t want to log out of that machine, there&#039;s not really any reason to use this method. Just SSH into the machine and run your command(s). Then log out when you&#039;re good and ready.&lt;br/&gt;&lt;br/&gt;Or, to answer your question more directly, I don&#039;t know of a way to do this, but I don&#039;t really know why you&#039;d need to either.&lt;br/&gt;&lt;br/&gt;-systemsboy</description>
		<content:encoded><![CDATA[<p>Razi,</p>
<p>The end of the command should not log you out of the Terminal. It should only log you out of the machine you&#8217;re SSHing to. If you don&#8217;t want to log out of that machine, there&#8217;s not really any reason to use this method. Just SSH into the machine and run your command(s). Then log out when you&#8217;re good and ready.</p>
<p>Or, to answer your question more directly, I don&#8217;t know of a way to do this, but I don&#8217;t really know why you&#8217;d need to either.</p>
<p>-systemsboy</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.010 seconds using disk: basic
Object Caching 369/370 objects using disk: basic

Served from: systemsboy.com @ 2012-02-09 00:41:20 -->
