Skip to content

Instantly share code, notes, and snippets.

@ertborTek
Last active December 10, 2015 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ertborTek/4502442 to your computer and use it in GitHub Desktop.
Save ertborTek/4502442 to your computer and use it in GitHub Desktop.
Catalog of Debian maintenance tasks.
################################################################################
# Catalog of common tasks.
################################################################################
#
# Update packages.
#
apt-get update;apt-get upgrade
#
# Clear swap.
#
swapoff `cat /proc/swaps | awk '{ORS=" ";if($0 ~ /^\/dev\//) print($1)}'`;swapon `cat /proc/swaps | awk '{ORS=" ";if($0 ~ /^\/dev\//) print($1)}'`
#
# Add user to a group.
#
usermod -a -G group user
#
# Append a time stamp to a file.
#
cp -i $SOURCE_FILE $SOURCE_FILE.`date +'%Y%m%d-%H%M%S'`
#
# Flush deferred mail from the mail queue.
#
postfix flush
#
# Delete all messages from the postfix mail queue.
*
postsuper -d ALL
#
# Set up SSH keys.
#
#Create public and private keys on local host:
user@local:~$ ssh-keygen
#If it doesn't already exist, create authorized host file on remote host:
user@remote:~$ mkdir .ssh && chmod 700 .ssh && touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
#Copy public key to remove host:
user@local:~$ cat ~/.ssh/id_rsa.pub | ssh user@remote.com 'cat - >> ~/.ssh/authorized_keys'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment