【发布时间】:2011-09-11 20:47:56
【问题描述】:
我正在试鞋,但卡住了。我正在尝试使用 ssh 连接到远程计算机并发出命令,让它在 cli 中工作,但我不能让它在鞋子上工作。 这可能是一件简单的事情,但我是新事物,我无法克服它。 这是我的代码在 atm 的样子
Shoes.setup do
gem 'net-ssh'
end
require "rubygems"
require "net/ssh"
Shoes.app do
button "Connect" do
append Net::SSH.start( '192.168.100.127', 'fox', :password => "xxxxxx" ) do
|ssh_connection|
ssh_connection.open_channel do |channel|
channel.on_data do |ch, data|
puts data
channel.exec "ls -la" do |ch, success|
para success
if success then
alert "uploaded"
else
alert "Fail"
end
end
end
end
end
end
end
【问题讨论】:
-
显示您的密码不是最好的主意 ;) 即使是本地服务
-
我从帖子中删除了密码。
-
请解释您遇到了什么错误。