1006
правок
Kekaloav (обсуждение | вклад) |
Kekaloav (обсуждение | вклад) м |
||
Строка 1: | Строка 1: | ||
Строка 7: | Строка 6: | ||
nmap -n --stats-every 1s -p 22,631 172.xx.xx.0/23 | grep -B 5 "631/tcp open" | grep -B 4 "22/tcp open" | grep 172 | sed 's/Nmap scan report for //' | grep -v Nmap > hosts.txt | nmap -n --stats-every 1s -p 22,631 172.xx.xx.0/23 | grep -B 5 "631/tcp open" | grep -B 4 "22/tcp open" | grep 172 | sed 's/Nmap scan report for //' | grep -v Nmap > hosts.txt | ||
</syntaxhighlight>hosts.txt - список имен или адресов компьютеров | |||
=== Установить ключи для root доступа по ssh === | |||
<syntaxhighlight lang="bash"> | |||
#!/bin/bash | |||
ssh-keygen -t ed25519 | |||
SSHKEY=`cat ${HOME}/.ssh/ed_id22519.pub` | |||
ROOTPASS="12345678" | |||
USER="user" | |||
PASS="12345678" | |||
for i in `cat hosts.txt` | |||
do | |||
(sleep 1;echo ${ROOTPASS};sleep 1; echo "${SSHKEY}" >> /root/.ssh/autorized_hosts ; echo exit; sleep 1; echo exit) | sshpass -p ${USERPASS} ssh -oStrictHostKeyChecking=no ${USER}@${i} su - | |||
done | |||
</syntaxhighlight> | </syntaxhighlight> | ||