Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Useful server configuration notes
- ## Enable persistent system logging
- ```
- sudo mkdir -p /var/log/journal
- ```
- ## Persistent terminal session
- ```
- nano ~/.bashrc
- ```
- ```
- ...
- if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then
- tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux
- fi
- ```
- ## Forward local mail
- ### Using `ssmtp`
- ```
- sudo apt install ssmtp -y
- sudo nano /etc/ssmtp/ssmtp.conf
- ```
- ```
- root=me@gmail.com
- mailhub=smtp.gmail.com:587
- AuthUser=me@gmail.com
- AuthPass=mypass
- UseSTARTTLS=YES
- FromLineOverride=YES
- ```
- Create an entry for each system user:
- ```
- sudo nano /etc/ssmtp/revaliases
- ```
- ```
- root:me@gmail.com:smtp.gmail.com:587
- ```
- Test:
- ```
- echo "testing" | ssmtp me@gmail.com
- ```
- ## Enable automatic updates
- ```
- sudo apt install unattended-upgrades -y
- ```
- Assuming `root` user emails are already forwarded:
- ```
- sudo nano /etc/apt.conf.d/50unattended-upgrades
- ```
- ```diff
- // Send email to this address for problems or packages upgrades
- // If empty or unset then no email is sent, make sure that you
- // have a working mail setup on your system. A package that provides
- // 'mailx' must be installed. E.g. "user@example.com"
- -//Unattended-Upgrade::Mail "root";
- +Unattended-Upgrade::Mail "root";
- // Set this value to "true" to get emails only on errors. Default
- // is to always send a mail if Unattended-Upgrade::Mail is set
- -//Unattended-Upgrade::MailOnlyOnError "true";
- +Unattended-Upgrade::MailOnlyOnError "true";
- ```
Add Comment
Please, Sign In to add comment