I need to run this command in a multiple linux server :
id -u user2 &>/dev/null || useradd -c "SSH account" -d /home/tools user2; echo 'password2' | passwd user2 --stdin
The idea is to create a text file with some IPs one per line and running the above command for each IP
But in somes linux servers, I can directly login as root@ip without password, but others linux servers I need to log as specific user@ip with password and switch to root
Any idea to do that ?