Guest User

Untitled

a guest
Oct 29th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. # Useful server configuration notes
  2.  
  3. ## Enable persistent system logging
  4.  
  5. ```
  6. sudo mkdir -p /var/log/journal
  7. ```
  8.  
  9. ## Persistent terminal session
  10.  
  11. ```
  12. nano ~/.bashrc
  13. ```
  14. ```
  15. ...
  16.  
  17. if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then
  18. tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux
  19. fi
  20. ```
  21.  
  22. ## Forward local mail
  23.  
  24. ### Using `ssmtp`
  25.  
  26. ```
  27. sudo apt install ssmtp -y
  28. sudo nano /etc/ssmtp/ssmtp.conf
  29. ```
  30. ```
  31. root=me@gmail.com
  32. mailhub=smtp.gmail.com:587
  33. AuthUser=me@gmail.com
  34. AuthPass=mypass
  35. UseSTARTTLS=YES
  36. FromLineOverride=YES
  37. ```
  38.  
  39. Create an entry for each system user:
  40. ```
  41. sudo nano /etc/ssmtp/revaliases
  42. ```
  43. ```
  44. root:me@gmail.com:smtp.gmail.com:587
  45. ```
  46.  
  47. Test:
  48. ```
  49. echo "testing" | ssmtp me@gmail.com
  50. ```
  51.  
  52. ## Enable automatic updates
  53.  
  54. ```
  55. sudo apt install unattended-upgrades -y
  56. ```
  57.  
  58. Assuming `root` user emails are already forwarded:
  59. ```
  60. sudo nano /etc/apt.conf.d/50unattended-upgrades
  61. ```
  62. ```diff
  63. // Send email to this address for problems or packages upgrades
  64. // If empty or unset then no email is sent, make sure that you
  65. // have a working mail setup on your system. A package that provides
  66. // 'mailx' must be installed. E.g. "user@example.com"
  67. -//Unattended-Upgrade::Mail "root";
  68. +Unattended-Upgrade::Mail "root";
  69.  
  70. // Set this value to "true" to get emails only on errors. Default
  71. // is to always send a mail if Unattended-Upgrade::Mail is set
  72. -//Unattended-Upgrade::MailOnlyOnError "true";
  73. +Unattended-Upgrade::MailOnlyOnError "true";
  74. ```
Add Comment
Please, Sign In to add comment