Closed iliaselmatani closed 10 years ago
What happens when you run which hostname
? One possible explanation is that hostname
is built into your shell, rather than being an actual executable.
Hi Williamson,
Tried the code
with shell:
result = shell.run(["which", "hostname"])
But the same result. Hereby also the logs from the ESXI-server.
2014-04-16T14:40:33Z sshd[3142035]: Connection from 1.2.3.4 port 39759
2014-04-16T14:40:34Z sshd[3142035]: Failed password for user1 from 1.2.3.4 port 39759 ssh2
2014-04-16T14:40:34Z sshd[3142038]: pam_per_user: create_subrequest_handle(): doing map lookup for user "user1"
2014-04-16T14:40:34Z sshd[3142038]: pam_per_user: create_subrequest_handle(): creating new subrequest (user="user1", service="system-auth-generic")
2014-04-16T14:40:34Z sshd[3142035]: Accepted keyboard-interactive/pam for user1 from 1.2.3.4 port 39759 ssh2
2014-04-16T14:40:34Z sshd[3142035]: pam_per_user: create_subrequest_handle(): doing map lookup for user "user1"
2014-04-16T14:40:34Z sshd[3142035]: pam_per_user: create_subrequest_handle(): creating new subrequest (user="user1", service="system-auth-generic")
2014-04-16T14:40:34Z sshd[3142035]: pam_unix(system-auth-generic:session): session opened for user user1 by (uid=0)
2014-04-16T14:40:34Z sshd[3142035]: User 'user1' running command 'command -v 'which' > /dev/null 2>&1 ; echo $?; exec 'which' 'hostname''
2014-04-16T14:40:34Z sshd[3142035]: pam_unix(system-auth-generic:session): session closed for user user1
Sorry, I meant trying to run which
manually. I'm not familiar with the ESXi shell -- does it support command -v
? Trying to run command -v hostname
might be more informative.
which hostname
~ # which hostname
/bin/hostname
and command -v hostname
~ # command -v hostname
-sh: command: not found
Ah, that's the issue then: Spur uses command -v
to determine if a command exists or not. The simplest fix is probably to fall back to using which
instead of command -v
if the latter doesn't exist (or possibly vice versa). Not sure when I'll have time to publish a fix, but feel free to have a go yourself if you like.
I've committed a potential fix to master
. Could you let me know whether that fixes the issue?
Fixed the issue. Thanks Williamson.
Great, thanks!
Hi there,
Trying to execute the command 'hostname' on an ESXi server but it fails with the error message: Command not found: hostname. Check that echo is installed and on $PATH
The code:
When executing the command manually using SSH getting the output from the server.
Kind regards, Ilias