Следите за новостями русскоязычного сообщества Ubuntu в Twitter-ленте @ubuntu_ru_loco
0 Пользователей и 1 Гость просматривают эту тему.
#!/usr/bin/expectspawn ssh -p123 user@host.ruexpect "user@host.ru's password:"send "gvery56uhsgd\n";interact
#!/usr/bin/expectspawn ssh -p123 user@host.ruexpect "user@host.ru's password:"send "gvery56uhsgd\n";spawn suexpect "Password:"send "ge53egshdsyr\n";interact
похоже на то, что надо, но что-то нифига не работает
Там в скрипте строка с паролем заканчивается возвратом каретки "\r".
expect -d myscript.exp
expect version 5.45argv[0] = expect argv[1] = -d argv[2] = login.exp set argc 0set argv0 "login.exp"set argv ""executing commands from command file login.expspawn ssh -p123 user@host.comparent: waiting for sync byteparent: telling child to go aheadparent: now unsynchronized from childspawn: returns {22363}expect: does "" (spawn_id exp7) match glob pattern "user@host.com's password:"? nouser@host.com's password: expect: does "user@host.com's password: " (spawn_id exp7) match glob pattern "user@host.com's password:"? yesexpect: set expect_out(0,string) "user@host.com's password:"expect: set expect_out(spawn_id) "exp7"expect: set expect_out(buffer) "user@host.com's password:"send: sending "password123\n" to { exp7 }expect: does " " (spawn_id exp7) match glob pattern "#"? noexpect: does " \r\n" (spawn_id exp7) match glob pattern "#"? no.....expect: set expect_out(0,string) "#"expect: set expect_out(spawn_id) "exp7"expect: set expect_out(buffer) " \r\nLinux host 2.6.32-042stab088.4 #"spawn suparent: waiting for sync byteparent: telling child to go aheadparent: now unsynchronized from childspawn: returns {22367}expect: does "" (spawn_id exp8) match glob pattern ": "? noПароль: expect: does "\u041f\u0430\u0440\u043e\u043b\u044c: " (spawn_id exp8) match glob pattern ": "? yesexpect: set expect_out(0,string) ": "expect: set expect_out(spawn_id) "exp8"expect: set expect_out(buffer) "\u041f\u0430\u0440\u043e\u043b\u044c: "send: sending "password321\r\n" to { exp8 }tty_raw_noecho: was raw = 0 echo = 1spawn id exp8 sent <\r\n>spawn id exp8 sent <su: \u0421\u0431\u043e\u0439 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043f\u043e\u0434\u043b\u0438\u043d\u043d\u043e\u0441\u0442\u0438\r\n>su: Сбой при проверке подлинностиinteract: received eof from spawn_id exp8tty_set: raw = 0, echo = 1tty_set: raw = 6, echo = 0
какие другие варианты?
Цитироватькакие другие варианты?выше ссылку на Fabric смотри, как раз для этих целей и создавался инструмент
Страница сгенерирована за 0.095 секунд. Запросов: 25.