surgeon Posted September 10, 2022 Posted September 10, 2022 (edited) Всем добрый день. Есть задача залить конфиг на 300+ через SSH скрипт. Но он почему-то зависает. #!/bin/bash iplist="SNR" while read -r line do echo "Patching IP "$line"" sshpass -p "pass" ssh -T -o StrictHostKeyChecking=no user@$line < cmd.cfg done < $iplist Зависает сама команда: ssh -T user@switch.test < cmd.cfg После ввода пароля, вывод зависает. В локах свича есть вход пользователя и все. Даже если в вводном файле всего одна команда, например who Если же использую "ssh -T user@switch.test who", то все отрабатывается норм. Что я делаю не так? SoftWare Version 7.0.3.5(R0241.0531) Заранее Спасибо Edited September 10, 2022 by surgeon Вставить ник Quote
Pinkbyte Posted September 14, 2022 Posted September 14, 2022 -vvv в ssh добавьте и выхлоп весь в файлы перенаправьте(&>/path/to/file) и смотрите Вставить ник Quote
surgeon Posted September 14, 2022 Author Posted September 14, 2022 (edited) On 9/14/2022 at 4:31 PM, Pinkbyte said: -vvv в ssh добавьте и выхлоп весь в файлы перенаправьте(&>/path/to/file) и смотрите похоже свич не присылает запрос на ввод Это ответ циски debug3: Ignored env OLDPWD debug2: channel 0: request shell confirm 1 debug3: send packet: type 98 debug2: channel_input_open_confirmation: channel 0: callback done debug2: channel 0: open confirm rwindow 0 rmax 32768 debug2: channel 0: rcvd adjust 2097152 debug3: receive packet: type 99 debug2: channel_input_status_confirm: type 99 id 0 debug2: shell request accepted on channel 0 debug2: channel 0: read<=0 rfd 4 len 0 debug2: channel 0: read failed debug2: channel 0: chan_shutdown_read (i0 o0 sock -1 wfd 4 efd 6 [write]) debug2: channel 0: input open -> drain debug2: channel 0: ibuf empty debug2: channel 0: send eof debug3: send packet: type 96 debug2: channel 0: input drain -> closed debug2: channel 0: rcvd ext data 53 stty: standard input: Inappropriate ioctl for device debug2: channel 0: written 53 to efd 6 debug3: receive packet: type 96 debug2: channel 0: rcvd eof debug2: channel 0: output open -> drain debug3: receive packet: type 98 <<<--- запрос от сервера на ввод debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug3: receive packet: type 97 debug2: channel 0: rcvd close debug3: channel 0: will not send data after close Это ответ SNR Quote debug3: Ignored env OLDPWD debug2: channel 0: request shell confirm 1 debug3: send packet: type 98 debug2: channel_input_open_confirmation: channel 0: callback done debug2: channel 0: open confirm rwindow 6000 rmax 1400 debug2: channel 0: read<=0 rfd 4 len 0 debug2: channel 0: read failed debug2: channel 0: chan_shutdown_read (i0 o0 sock -1 wfd 4 efd 6 [write]) debug2: channel 0: input open -> drain debug2: channel 0: ibuf empty debug2: channel 0: send eof debug3: send packet: type 96 debug2: channel 0: input drain -> closed debug3: receive packet: type 99 <<<--- сервер не ожидает ответа, если я правильно понял RFC debug2: channel_input_status_confirm: type 99 id 0 debug2: shell request accepted on channel 0 debug3: send packet: type 1 debug1: channel 0: free: client-session, nchannels 1 debug3: channel 0: status: The following connections are open: Ну, как-то так. Edited September 14, 2022 by surgeon Вставить ник Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.