Forwarded from UNDERCODE NEWS
Fresh patent exposure for Microsoft: to use personal details to build a robot for the automated rebirth of dead.
#Technologies
#Technologies
β β β Uππ»βΊπ«Δπ¬πβ β β β
π¦Creating bash script for multiple remote logins :
Β» create a script to help copy the public key to multiple remote Linux hosts.
# vim ~ / .bin / ssh-copy.sh
Copy and paste the following code into the file (replace the following variables accordingly USER_NAME is the username to connect, HOST_FILE is the file containing the list of hostnames or IP addresses, and ERROR_FILE is the file to store any errors from the ssh command).
#! / bin / bash
USER_NAME = "root"
HOST_FILE = "/ root / hosts"
ERROR_FILE = "/ tmp / ssh-copy_error.txt"
PUBLIC_KEY_FILE = "$ 1"
if [! -f $ PUBLIC_KEY_FILE]; then
echo "File '$ PUBLIC_KEY_FILE' not found!"
exit 1
fi
if [! -f $ HOST_FILE]; then
echo "File '$ HOST_FILE' not found!"
exit 2
fi
for IP in
ssh-copy-id -i $ PUBLIC_KEY_FILE $ USER_NAME @ $ IP 2> $ ERROR_FILE
RESULT = $?
if [$ RESULT -eq 0]; then
echo ""
echo "Public key copied to $ IP successfully"
echo ""
else
echo "$ (cat $ ERROR_FILE)"
echo
exit 3
fi
echo ""
done
Save the file and close it.
Then make the script executable with the chmod command, as follows:
# chmod + x ssh-copy.sh
Now run the ssh-copy.sh script and provide your public key file as the first argument as shown below:
# ./ssh-copy.sh /root/.ssh/prod-rsa.pub
Then use ssh-agent to manage your keys, which stores your decrypted private key in memory and uses it to authenticate logins.
After starting ssh-agent add your private key to it like this:
# eval "$ (ssh-agent -s)"
# ssh-add ~ / .ssh / prod_rsa
Login to remote Linux server without password
You can now log into any of your remote hosts without entering a password to authenticate the SSH user.
This way you can automate cross-server processes.
# ssh root@10.2.xy
(be smart & don't copy our tips !|)_
β β β Uππ»βΊπ«Δπ¬πβ β β β
π¦Creating bash script for multiple remote logins :
Β» create a script to help copy the public key to multiple remote Linux hosts.
# vim ~ / .bin / ssh-copy.sh
Copy and paste the following code into the file (replace the following variables accordingly USER_NAME is the username to connect, HOST_FILE is the file containing the list of hostnames or IP addresses, and ERROR_FILE is the file to store any errors from the ssh command).
#! / bin / bash
USER_NAME = "root"
HOST_FILE = "/ root / hosts"
ERROR_FILE = "/ tmp / ssh-copy_error.txt"
PUBLIC_KEY_FILE = "$ 1"
if [! -f $ PUBLIC_KEY_FILE]; then
echo "File '$ PUBLIC_KEY_FILE' not found!"
exit 1
fi
if [! -f $ HOST_FILE]; then
echo "File '$ HOST_FILE' not found!"
exit 2
fi
for IP in
cat $ HOST_FILE; dossh-copy-id -i $ PUBLIC_KEY_FILE $ USER_NAME @ $ IP 2> $ ERROR_FILE
RESULT = $?
if [$ RESULT -eq 0]; then
echo ""
echo "Public key copied to $ IP successfully"
echo ""
else
echo "$ (cat $ ERROR_FILE)"
echo
exit 3
fi
echo ""
done
Save the file and close it.
Then make the script executable with the chmod command, as follows:
# chmod + x ssh-copy.sh
Now run the ssh-copy.sh script and provide your public key file as the first argument as shown below:
# ./ssh-copy.sh /root/.ssh/prod-rsa.pub
Then use ssh-agent to manage your keys, which stores your decrypted private key in memory and uses it to authenticate logins.
After starting ssh-agent add your private key to it like this:
# eval "$ (ssh-agent -s)"
# ssh-add ~ / .ssh / prod_rsa
Login to remote Linux server without password
You can now log into any of your remote hosts without entering a password to authenticate the SSH user.
This way you can automate cross-server processes.
# ssh root@10.2.xy
(be smart & don't copy our tips !|)_
β β β Uππ»βΊπ«Δπ¬πβ β β β