I once said:
I’m horribly lazy when it comes to setting up machines.
Indeed. And this page is dedicated to fixing that.
Let’s write a quick bundle of settings I use to set up machines, shall we?
Note: i use C locale with Slovene keyboard when I set up new Debian 10. Just a taste.
As soon as I manage to set up a basic Debian install and log in as root:
sed -i 's/\\l/\\l \\4/g' /etc/issue
reboot
Now, I see IP before I log in to the shell, and can safely ssh into the machine with normal user. There, I first do:
echo "alias ls='ls -laF --color=auto'" >> ~/.bashrc
echo "alias ipconfig='ifconfig'" >> ~/.bashrc
echo "alias ss='ss -lpn'" >> ~/.bashrc
echo "PS1='\[\e[1;37m\]\h\[\e[1;33m\]:\[\e[0;32m\]\u\[\e[1;33m\]:\[\e[0;36m\][\w]\[\e[1;33m\]:\[\033[m\]\\$ '" >> ~/.bashrc
su -
Now, I do this as root:
cd
mkdir .ssh
apt-get update && apt-get upgrade -y
apt-get install -y bmon curl htop iputils-ping lnav net-tools screen tmux unzip vim wget
sed -i '/^#PermitRootLogin /s/^#//' /etc/ssh/sshd_config && service sshd restart
echo "alias ls='ls -laF --color=auto'" >> ~/.bashrc
echo "alias ipconfig='ifconfig'" >> ~/.bashrc
echo "alias ss='ss -lpn'" >> ~/.bashrc
echo "PS1='\[\e[1;37m\]\h\[\e[1;33m\]:\[\e[0;31m\]\u\[\e[1;33m\]:\[\e[0;36m\][\w]\[\e[1;33m\]:\[\033[m\]\\$ '
" >> ~/.bashrc
cd ~/.ssh/
echo $SSH_CLIENT | awk '{ system("sftp john@" $1 ":/home/john/.ssh/vm-conf/authorized_keys")}'
reboot
Locales info: Here
.bashrc info: here PS1
SFTP: that’s where I keep my authorized_keys file, and it does not depend on whether I am on wifi or ethernet.
laughing at the facts: Alias from ipconfig to ifconfig because my legacy in windows waters…