-5
I need to configure two files. sh, the first sshpasssrv.sh file will be responsible for filling in the second file that will be sshpass.sh, the first file when executed, will ask for the ip, then it will fill the following file with the ip I want in the following command line: sshapss -p "password" ssh [email protected] for example, I have more or less the following idea, I need to fill the second file only with ip.
#!/bin/bash
#Aki pega o que digitar e coloca na variavel sshpass
echo "IP DO ARQUIVO SSHPASS :"
read ip
# Aki ele nao faz nada + do que a saida do comando echo $ip ele coloca no arquivo sshpass.sh
echo $ip >> sshpass.sh
sed "sshpass -p "pdvlinux" "$ip sshpassh.sh
in case using ssh with private/foreign key would look like? which your suggestion?
– Ricardo JM Sistemas
@Ricardojmsistemas Before you have to create a public/private key on the client machine with the ssh-keygen command. Ai vc copies the contents of the file . pub created in the ~/. ssh folder for the ~/. ssh/authorized_keys file on your server. With this you should be able to log into the server from your client by only doing a "ssh root@$ip" you do not need to pass the password. This link has a step by step with images to facilitate.
– Fabricio