ara.t.howard [email protected] wrote:
not easily.
- use ssh keys and specify only key auth so it fails otherwise
- use net/ssh
- use a pty to provide the password
- rely on ssh-agent
- do hairly io operations to enter the passprase yourself
first thanks for your reply.
firstly, i’ve tried without ruby, from zsh shell.
if i don’t use ssh-agent like :
$ ssh -p 2222 [email protected]
Enter passphrase for key ‘/Users/yt/.ssh/id_dsa’:
Permission denied (publickey).
NO access in that case.
however using ssh-agent that way :
$ eval ssh-agent -s
Agent pid 2044
$ ssh-add ~/.ssh/id_dsa
Enter passphrase for /Users/yt/.ssh/id_dsa:
Identity added: /Users/yt/.ssh/id_dsa (/Users/yt/.ssh/id_dsa)
$ echo $SSH_AUTH_SOCK
/tmp/ssh-kbqXlJAxOy/agent.2043
$ ssh -p 2222 [email protected]
| || | |__ || _ || _ || | | |
| || __| ___ | | | || || || || |__ |____ |
| | | | || || ||||||||
|| || Bienvenue sur le Twin Tact !!!
Last login: Tue Jul 22 08:31:35 UTC 2008
exit
Connection to 169.254.0.2 closed.
$scp -P 2222 Sun_URLs.txt [email protected]:/mnt/fat
Sun_URLs.txt 100% 307 0.3KB/s 00:00
then, using ssh-agent, i can do what i want.
why such a difference ?
obviously have tried also using net/ssh and net/scp (+Highline) with
ruby :
require ‘net/ssh’
require ‘net/scp’
Net::SSH.start(“169.254.0.2”, “root”, :password => “”,
:port => 2222) do |ssh|
ssh.scp.upload! “/mnt/fat”, “/Users/yt/Desktop/scp_ESSAIS.txt”
end
here i got :
Enter passphrase for /Users/yt/.ssh/id_dsa:
/opt/local/lib/ruby/gems/1.8/gems/net-ssh-2.0.3/lib/net/ssh.rb:195:in
`start’: root (Net::SSH::AuthenticationFailed)
from ./net-scp.rb:15
then net/ssh is asking for the pass phrase althought it’s given by
:password
may be there is another option for the passphrase not being the same as
:password ?