Category Archives: Linux

Best console tool for finding disk usage

Just a post to pay tribute to the awesome tool ncDu is. If you ever need to find where the lost diskspace went to use this tool.
(https://dev.yorhel.nl/ncdu)

Free up cache memory

free && sync && echo 3 > /proc/sys/vm/drop_caches && free

See what is passing though the varnish proxy without a log

First add a header to see what is going on in the varnish proxy

vcl 4.0;
 
sub vcl_deliver {
    # Happens when we have all the pieces we need, and are about to send the
    # response to the client.
    #
    # You can do accounting or modifying the final object here.
        if (obj.hits > 0) {
                set resp.http.X-Cache = "HIT";
        } else {
                set resp.http.X-Cache = "MISS";
        }
}

No we can us varnishlog to see what urls are passing as a miss!

varnishlog -q ‘RespHeader ~ “X-Cache: MISS”‘ | grep -i requrl

Generate dhparam

openssl dhparam -out /etc/nginx/ssl/dhparam.pem 4096

change or add passphrase to key

ssh-keygen -f keyfile -p

SSHd keys only

edit the sshd_config. (most likely located at /etc/ssh)

Change

PermitRootLogin		yes
PasswordAuthentication	yes
UsePAM			yes

to

PermitRootLogin		no
PasswordAuthentication	no
UsePAM			no