Remote execution via Ruby-SSH starts different shell - solved
-
Hello,
we are using net/ssh in Ruby to execute scripts on a PfSense machine, in order to do some checks for Nagios. Actually it is a brand new Pfsense applicance.
The code is roughly the following:Net::SSH.start(@host, @user, {:password=>@pass}) do |ssh| erg=ssh.exec! "ls -al" p erg end
When we execute this, we get a message, that the parameter "l" in "ls -al" is wrong. This is strange to me, as this works on a normal command line. Passing "ls -a" works however and produces the desired output.
"echo $0" shows not output, so I suspect, there is something wrong with the shell here.Remotely executing "env" displays the following
SSH_CLIENT=192.168.12.252 53798 22 LOGNAME=admin FTP_PASSIVE_MODE=YES MAIL=/var/mail/admin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin PWD=/root TERM=su USER=admin HOME=/root SSH_CONNECTION=192.168.12.252 53798 192.168.12.254 22 SHELL=/etc/rc.initial BLOCKSIZE=K
We also tried to execute "tcsh -c <command></command>" but he complains about the "-c" parameter.
So I am confused, which shell is actually run, when remotely executing via ssh. And how I can run an remote command via tcsh?
Any help is appreciated.
Edit: Marked a solved
-
Are you using admin@ for the account? If so, don't. Use root@.
The way admin@ is setup it doesn't support commands like that, or scp. root@ uses the same password but will work for those functions.
-
Thank you, that did the trick.