Перейти к содержимому
Калькуляторы

SSH скрипт для заливки конфига на S2962

 Всем добрый день.

 

Есть задача залить конфиг на 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)

 

 

Заранее Спасибо

 

Изменено пользователем surgeon

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

-vvv в ssh добавьте и выхлоп весь в файлы перенаправьте(&>/path/to/file) и смотрите

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

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:

 

Ну, как-то так.

 

Изменено пользователем surgeon

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

×   Вставлено в виде отформатированного текста.   Вставить в виде обычного текста

  Разрешено не более 75 смайлов.

×   Ваша ссылка была автоматически встроена.   Отобразить как ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.