Initial steps freshly

Enable SSH

Genesis step for all Linux works.

Generate Public/Private key pair

  ssh-keygen -t rsa -b 4096 
  ssh-keygen -t dsa
  ssh-keygen -t ecdsa -b 521
  ssh-keygen -t ed25519
  touch $home/.ssh/authorized_keys 
  chmod 600 $home/.ssh/authorized_keys 

Append public keys for SSH client.

Configure Dynamic DNS

Google Domains with ddclient

Dynamic DNS records are configured in Google Domains, then update IP using ddclient.Set Up Dynamic DNS in Google Domains. Keep generated credentials to use in ddclient.

  sudo apt-get install ddclient 

ddclient and related packages are installed and will pop up the screen to ask a few parameters. Just do it as you wish and exit quickly. This is not your big deal.
Edit /etc/ddclient.conf


If this configuration is not work when you run ddclient -noquiet with some WARNINGs because ddclient does not support Google Domains directly. Then change configuration file as followings:

Google Domain protocol is updated, so use it directly.

  use=web                # this is essential.

Edit sudo crontab -e to run periodically or register as daemon to run start.

Cloudflare with ddclient

Assume you already installed ddclient before this. — Google Domains with ddclient

It require a package libjson-any-perl

  sudo apt-get install libjson-any-perl

edit /etc/ddclient.conf

 protocol=cloudflare, 				\,				\,		\
 password=cloudflare-API-global-token		\,

login is email address for Cloudflare and password is API key string. Cloudflare™ with ddclient uses JSON format.

  sudo ddclient -verbos -noquiet 

Run with -verbos and -noquiet option to see the progress. Messages, if any, error(s) show up. add work in crontab with root permission

  sudo crontab -e 
30 */2 * * * /usr/sbin/ddclient -quiet 

This crontab runs at minute 30 past every 2nd hour.

FreeDNS with ddclient

Edit /etc/ddclient.conf


Add crontab schedule,

  sudo crontab -e 

Google Domains with API

Create Synthetic record with Dynamic DNS option and keep generated credentials

### Google Domains provides an API to update a DNS "Syntheitc record". This script
### updates a record with the script-runner's public IP, as resolved using a DNS
### lookup.
### Google Dynamic DNS:
### Synthetic Records:
# Resolve current public IP
IP=$( dig +short )
# Update Google DNS Record
curl -s $URL

Cloudflare with API

Getting user's data from Cloudfalre™ Before, you set up the dynamic DNS from Cloudfalre™, you need to set A record with your desired domain name. If you want to use DDNS.DOMAIN.COM as your dynamic DNS. Put A record in DOMAIN.COM section.

curl -X GET '' \
    -H 'X-Auth-Email: 'YOU@DOMAIN.COM \
    -H 'X-Auth-Key: '8afbeYOUR0API0KEY0INdCLOUDFLARE0 \
    -H 'Content-Type: application/json'

Check your Global API key for X-Auth-Key from My Profiles and Zone ID can be found in your DOMAIN.COM page.

This will shows bunch of strings and just copy them or your can make text file appending » ~/cloudflare.json

To find data you want, you need to arrange using Online JSON parser or your editor. Find out id value for specific domains. Here assume id for ddns.DOMAIN.COM under DOMAIN.COM is 372e679540…86b9e0b59 Make shell script.

 CURRENT_IP=`cat /var/tmp/current_ip.dat`
  if [ "$NEW_IP" = "$CURRENT_IP" ]
      echo "No Change in IP Adddress"
   curl -X PUT '' \
    -H 'X-Auth-Email: 'YOU@DOMAIN.COM \
    -H 'X-Auth-Key: '8afbeYOUR0API0KEY0INdCLOUDFLARE0 \
    -H 'Content-Type: application/json' \
    --data '{
        "type": "A",
        "name": "",
        "content": '\"$NEW_IP\"',
        "proxied": true
   echo $NEW_IP > /var/tmp/current_ip.dat

grant execute permission

  sudo chmod +x ./

and touch file to record current IP address.

  sudo touch /var/tmp/current_ip.dat is API to retrieve external IP for Dynamic DNS. Alternatives are or
If your script is /usr/bin/, edit crontab to update IP periodically.

  sudo crontab -e 
  *   */3   *   *   *   /usr/bin/ 

Then the script runs every 3 hours.
Júnes's configuration and scripts WebDAV — Updated on 2017/08/24 22:06

Disable suspend mode

Disable / Ignore suspend mode of laptop for lasting online even when LCD lid is closed.

Edit /etc/systemd/logind.conf


Comment out the items that you wish to edit. HandlePowerKey is for when pressing Power key. HandleSuspendKey is for suspend key (if exists). HandleHibernateKey is for hibernation key. And HandleLidSwitch is for lid panel.


Disable Hardware Acceleration

Section "Extensions"
    Option "GLX" "Disable"

Debugging service

  sudo service stop sshd   # ssd daemon for example 
  /usr/sbin/sshd -d       # need to specify full path 

Find problem from messages in debugging mode.

Delete unnecessary files regularly

sudo crontab -e Add command line to find & delete. e.g.) Delete all .nfo file in target directory and its sub-directories at 30 minutes past every 6 hours.

  30 */6 * * * /usr/bin/find /..((your path)).../ -name '*.nfo' -exec rm -f {} \;

Delete empty directory at 30 minutes past every 12 hours

  30 */12 * * * /usr/bin/find /..((your path)).../ -type d -empty -delete

Delete all files except for desired file types

 find . -type f ! -name '*.mkv' -delete

Disable power wireless off

 sudo iwconfig wlan0 power off 

User defined command alias

If you don't have .bash_aliases in your home directory.

touch .bash_aliases    

Edit .bash_aliases. Example: Backup Nginx configuration files with date stamp.

alias backup_nginx='sudo rsync -avh --progress /etc/nginx/ /home/user/storage/Nginx.Config//nginx_config_`date +"%Y%m%d"`/'

Basic commands 101

Rico's cheatsheets – First glimpse on Linux commands


  rm -R			\\ Remove directory, Recursively
  rm -i			\\ Remove with confirmation 
  rm -f			\\ Force deletion of Files Directories 
  rm -v			\\ Show information of deletion process, Verbosely 

ufw (firewalls)

  sudo ufw app list		\\ show app list by firewall 
  sudo ufw allow OpenSSH	\\ allow OpenSSH 
  sudo ufw enable  
  sudo ufw status  


To retrieve hardware information such as serial number of product,

  sudo udevadm info --query=all --name=/dev/sda

  • debian_common
  • Last modified: 2018/08/14 20:07
  • by Júne Park