Bash
Change default shell to fish
chsh -s /usr/bin/fish
It will then prompt you to enter your password
Change default shell back to bash
chsh -s /bin/bash
Change default visudo editor
sudo update-alternatives --config editor
set ownership of folder to current user
chown -R $(whoami) ~/FOLDER
for loop (foreach doesn't work in almalinux?)
All these assume that there is a txt file called serverips.txt
with IPs separated by new lines (enter
, \n
etc)
for ip in $(cat serverips.txt); do ssh-copy-id root@$ip; done
for ip in $(cat serverips.txt); do ssh root@$ip passwd USER; done
A way to see if all servers are connected (after copying ssh keys)
for ip in $(cat serverips.txt); do ssh root@$ip "hostnamectl"; echo ""; done
Make user sudo without password (has issues with passwords that have special characters)
for ip in $(cat serverips.txt); do ssh USER@$ip 'hostnamectl; echo ""; sudo echo "USER ALL=(ALL) NOPASSWD:ALL" | sudo -S tee -a /etc/sudoers.d/ansible_admin'; done
Change machine-id
In cases where you clone a machine, they would have the same machine-id
Check your machine-id
cat /etc/machine-id
# remove or move
/etc/machine-id
sudo systemd-machine-id-setup
cat /etc/machine-id