PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.security.ssh > Cannot run programs via ssh
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.security.ssh SSH secure remote login and tunneling tools.

Cannot run programs via ssh

Réponse
 
LinkBack Outils de la discussion
Vieux 09/10/2006, 12h54   #1
Christian Christmann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Cannot run programs via ssh

Hi,

the authentication between my Linux machines is done
by public keys without password.

When I login on a machine and invoke "xterm", the
application is started without any problems. However,
when I run "ssh HOSTNAME xterm" I get the error message:

stty: standard input: Invalid argument
bash: line 1: xterm: command not found

and xterm is not started.

Here is my sshd_config:

Port 22
Protocol 2
HostKey /etc/ssh/ssh_host_key
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
PidFile /etc/sshd.pid
StrictModes yes
KeepAlive yes
LoginGraceTime 30
AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
ServerKeyBits 768
KeyRegenerationInterval 3600
PasswordAuthentication yes
RSAAuthentication yes
DSAAuthentication no
RhostsRSAAuthentication yes
HostbasedAuthentication yes
IgnoreRhosts yes
IgnoreUserKnownHosts yes
PermitRootLogin yes
PermitEmptyPasswords no
UseLogin no
PrintMotd no
Compression yes
SyslogFacility AUTH
LogLevel INFO

Any ideas how I can fix this problem?

It seems that the environment variable PATH is not
initialized correctly.

Regards,
Chris

  Réponse avec citation
Vieux 09/10/2006, 16h41   #2
Todd H.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Cannot run programs via ssh

Christian Christmann <plfriko@yahoo.de> writes:

> Any ideas how I can fix this problem?


Try to specify the full path to xterm and see if the problem doesn't
go away.

$ ssh hostname /path/to/xterm

But first try it with a non-X program to rule out X environment issues
in the equation.


--
Todd H.
http://www.toddh.net/
  Réponse avec citation
Vieux 09/10/2006, 17h25   #3
Christian Christmann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Cannot run programs via ssh

On Mon, 09 Oct 2006 10:41:52 -0500, Todd H. wrote:

> Christian Christmann <plfriko@yahoo.de> writes:
>
>> Any ideas how I can fix this problem?

>
> Try to specify the full path to xterm and see if the problem doesn't
> go away.
>
> $ ssh hostname /path/to/xterm
>
> But first try it with a non-X program to rule out X environment issues
> in the equation.


When I specify the full path name, it works.
non-X programs also work without the full path name.

I think that the problem comes from the PATH variable. On my Debian
system xterm is in /usr/X11R6/bin, but this path seems not to be
contained in the PATH environment variable. Thus, xterm is not found.

Are there any ways to define a PATH variable for ssh when executing
applications (without login)? I've read somewhere that these paths
must be specified when compiling ssh, but I don't think that this
is the only solution.

I also wonder why ssh does not read my /etc/profile and my
/etc/bash.bashrc when executing an application. A possible solution
would be to force ssh to read /etc/profiles but I couldn't find a
way to do so. And ideas?

  Réponse avec citation
Vieux 09/10/2006, 17h51   #4
Todd H.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Cannot run programs via ssh

Christian Christmann <plfriko@yahoo.de> writes:

> I also wonder why ssh does not read my /etc/profile and my
> /etc/bash.bashrc when executing an application. A possible solution
> would be to force ssh to read /etc/profiles but I couldn't find a
> way to do so. And ideas?


ssh(1)
...
If command is specified, command is executed on the remote host
instead of a login shell.

The processing of bashrc and I believ /etc/profile are all specific
to a login shell.

You could always cheat and do

ssh hostname "source /etc/profile;xterm"

maybe?


--
Todd H.
http://www.toddh.net/
  Réponse avec citation
Vieux 09/10/2006, 20h41   #5
Doug McIntyre
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Cannot run programs via ssh

Christian Christmann <plfriko@yahoo.de> writes:
>When I specify the full path name, it works.
>non-X programs also work without the full path name.


>I think that the problem comes from the PATH variable. On my Debian
>system xterm is in /usr/X11R6/bin, but this path seems not to be
>contained in the PATH environment variable. Thus, xterm is not found.

...
>I also wonder why ssh does not read my /etc/profile and my
>/etc/bash.bashrc when executing an application. A possible solution
>would be to force ssh to read /etc/profiles but I couldn't find a
>way to do so. And ideas?


ssh running a command is an interactive shell, not a login shell. The
man page for bash documents what rc files are sourced and in what
order when run interactivly vs. a login shell.

What file is /etc/bash.bashrc though? Some custom weird-random thing for
your system? Stock bash wouldn't touch that file.

Most likely, all you need to do is set your PATH appropriately in your
~/.bash_profile RC file, and you'll be all set to do whatever you want.


  Réponse avec citation
Vieux 09/10/2006, 21h39   #6
Christian Christmann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Cannot run programs via ssh

On Mon, 09 Oct 2006 11:51:12 -0500, Todd H. wrote:


>
> The processing of bashrc and I believ /etc/profile are all specific
> to a login shell.
>
> You could always cheat and do
>
> ssh hostname "source /etc/profile;xterm"
>
> maybe?


I've found that you can specify a file called sshrc in your global
ssh directory. In that file I added an "echo" and "source /etc/profile".
The echo is displayed when I login via ssh on that ssh server, but
the "export PATH=$PATH:/usr/X11R6/bin" from /etc/profile is still not set.
Why?

  Réponse avec citation
Vieux 09/10/2006, 22h49   #7
Christian Christmann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Cannot run programs via ssh

On Mon, 09 Oct 2006 19:41:31 +0000, Doug McIntyre wrote:

>
> What file is /etc/bash.bashrc though? Some custom weird-random thing for
> your system? Stock bash wouldn't touch that file.


bash.bashrc is Debian's "systemwide per-interactive-shell startup file".

>
> Most likely, all you need to do is set your PATH appropriately in your
> ~/.bash_profile RC file, and you'll be all set to do whatever you want.


Yea, I know. Setting path in ~/.bashrc would fix my problem. However,
I'm looking for a solution that sets the PATH variable globally
independently of the user local settings.


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 19h24.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12955 seconds with 15 queries