Код: Выделить всё
ssh user@host < pass.txt(В pass.txt - пароль)
Конечно, можно воспользоваться ключами, но хотел бы узнать, почему такой способ не прокатывает.
Модераторы: /dev/random, Модераторы разделов
Код: Выделить всё
ssh user@host < pass.txtIts all about using the right tool for the job.
To script interactive sessions, you need to use Expect.
For example to login to an anonymous ftp server and not have to manually enter the login information each time, use the following expect script:
#!/usr/bin/expect
spawn ftp $argv
expect "Name"
send "anonymous\r"
expect "Password:"
send "user@hostname.com\r"
interact
When you execute the script:
$ expect ./ftp-login.exp upload.sf.net
It will log you in and leave you at the ftp> prompt, where it enters interactive mode. When you are done, simple exit the ftp session normally (quit command) and the expect session will terminate.