A
Amit Chitre
Running on WinXP, ssh to Solaris. Tried using the shell as well as
popen3 channel method but doesn't work... just sits there spinning..
Let me know what I'm doing wrong, if it's even allowed
<--popen3 channel method-->
require 'net/ssh'
session = Net::SSH.start( 'myserver.com',
'user_id',
'old_password',
:auth_methods => %w(password keyboard-interactive) )
session.process.popen3( "passwd" ) do |input, output, error|
[ "old_password", "new_password", "new_password" ].each do |passwords|
input.puts passwords
puts output.read
end
end
session.close
<--shell method-->
require 'net/ssh'
session = Net::SSH.start( 'myserver.com',
'user_id',
'old_password',
:auth_methods => %w(password keyboard-interactive) )
shell = session.shell.sync
out = shell.pwd
p "Working Dir==>>" << out.stdout
out = shell.send_command( "passwd", <<CMD)
old_password
new_password
new_password
CMD
p out.stdout
shell.exit
session.close
=============
If this is not allowed, please suggest other options to change
passwords on unix servers in programmatic fashion.
Thanks ...
Amit
popen3 channel method but doesn't work... just sits there spinning..
Let me know what I'm doing wrong, if it's even allowed
<--popen3 channel method-->
require 'net/ssh'
session = Net::SSH.start( 'myserver.com',
'user_id',
'old_password',
:auth_methods => %w(password keyboard-interactive) )
session.process.popen3( "passwd" ) do |input, output, error|
[ "old_password", "new_password", "new_password" ].each do |passwords|
input.puts passwords
puts output.read
end
end
session.close
<--shell method-->
require 'net/ssh'
session = Net::SSH.start( 'myserver.com',
'user_id',
'old_password',
:auth_methods => %w(password keyboard-interactive) )
shell = session.shell.sync
out = shell.pwd
p "Working Dir==>>" << out.stdout
out = shell.send_command( "passwd", <<CMD)
old_password
new_password
new_password
CMD
p out.stdout
shell.exit
session.close
=============
If this is not allowed, please suggest other options to change
passwords on unix servers in programmatic fashion.
Thanks ...
Amit