This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pass='YOURPASSWORD' | |
for host in `cat ips` | |
do | |
sshpass -p $pass ssh -o ConnectTimeout=1 -o StrictHostKeyChecking=no -o GSSAPIAuthentication=no root@$host "hostname" | |
done | |
### Using encoding to escape Shoulder Surfing ;) | |
vim tempfile | |
#In the file write your password | |
cat tempfile | openssl enc -base64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sed -e 's/$/string after each line/' -i filename | |
#So for me I needed to add "& ~" at the end of all lines in my file so that I could copy it to rsyslog.conf to receive logs from the network devices. | |
#Initial File: | |
if $fromhost-ip == '1.1.1.1' then /var/log/Switches/Switch1.log | |
if $fromhost-ip == '2.2.2.2' then /var/log/Switches/Switch2.log | |
. . . . . . | |
. . . . . . | |
. . . . . . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#To delete all whitespace: cat file.txt | tr -d "[:space:]" | |
#To delete all horizontal whitespace: cat file.txt | tr -d "[:blank:]" | |
#Using LibreOffice calc in the final stage I had two columns to merge. Eg: | |
/var/log/Switches/ Switch1 | |
/var/log/Switches/ Switch2 | |
. . | |
. . | |
. . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create SFTP User | |
## This script will create the account with read-only permissions which helps us to give the user download-only files. Along with that we give a directory "uploads" that is present inside the user's home and can be used for uploading whichis having read-write access for this user. | |
echo "========================================================================================================================" | |
echo " SFTP account creation. The home dir will be read-only, for write access the user should use "uploads" directory in home." | |
echo "========================================================================================================================" | |
# Input username and the number of days that the user will be active. Only enter the "username" and "number" of days. |