Is there any way to disable or set the page-length of a ruby Net-SSH connection so we don't have to change the settings on the remote device?
In Cisco routers we would use the parameters "terminal length 0" to accomplish this but on other servers we can't use any simular commands. Can this be set via the Net-SSH lib?
Assuming the remote end has a shell then the terminal height is set in the LINES environment variable. You can try setting it like this:
Net::SSH.start('hostname', 'user') do |ssh|
ssh.exec!('LINES=50 your-command-here')
end
If you don't have a shell you can try having net-ssh push it:
ENV['LINES'] = '50'
Net::SSH.start('hostname', 'user', send_env: ['LINES']) do |ssh|
ssh.exec!('your-command-here')
end
However, this requires the cooperation of sshd. If it's OpenSSH, edit /etc/ssh/sshd_config and make sure AcceptEnv includes LINES.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With