unbewusst.sein
7/26/2008 8:42:00 AM
Peña, Botp <botp@delmonte-phil.com> wrote:
> show net/ssh version and code pls.
net/ssh 2.0.3
net/scp 1.0.1
--- ssh_exec_ls.rb -----------------------------------------------------
#! /usr/bin/env ruby
require 'net/ssh'
result=""
options={
:config => false,
#:config => "/Users/yt/.ssh/ssh_config",
:paranoid => false,
#:verbose => :debug,
:auth_methods => ["publickey"],
:user_known_hosts_file => "/Users/yt/.ssh/known_hosts",
:keys => ["/Users/yt/.ssh/id_dsa"],
:passphrase => "A very vety long passphrase.",
:port => 2222
}
Net::SSH.start("169.254.0.2", "root", options) do |session|
result=session.exec!("cd /mnt/fat;ls -Al")
end
puts result
--- /ssh_exec_ls.rb ----------------------------------------------------
> eg, i just run this,
>
> Net::SSH.start( "10.2.10.1", "botp:)", :password=>"secret=)") do |session|
> puts session.exec! "cd /etc; ls -la"
> end
about the same except authentification by passphrase.
>
> works, right?
i got :
$ ./ssh_exec_ls.rb
exec: 4: cd: not found
if, by command line, i log into the device :
$ ./ssh_connect.zsh open
Enter passphrase for /Users/yt/.ssh/id_dsa:
Identity added: /Users/yt/.ssh/id_dsa (/Users/yt/.ssh/id_dsa)
[...]
Last login: Sat Jul 26 08:57:20 UTC 2008
# cd /mnt/fat
# ls -Al
-rwxr-xr-x 1 root root 6148 Jul 23 10:04 .DS_Store
[...]
-rwxr-xr-x 1 root root 16384 Jul 19 07:52 x-loader.bin
# which cd
#
notice "which cd" returns nothing, this is a builtin shell command.
for example on MacOS X :
$ which cd
cd: shell built-in command
i should mention the remote device is a handheld phone running linux
Kernel 2.4.x (QTopia over OMAP 730 from TI)
also, I've a lot of "SCP did not finish successfully" not repeatable.
those scp errors are only reported when using ruby (net/ssh + net/scp)
but not when using my zsh script.
--
Une Bévue