How to setup SSH private and public keys

  • 1)
    ssh-keygen -t rsa -b 4096 Generating public/private rsa key pair.
    Enter file in which to save the key (~/.ssh/id_dsa): 
    (just press Enter) 
    Enter passphrase (empty for no passphrase): 
    (enter a passphrase and then press Enter or if you don't want want one just press Enter) 
    Enter same passphrase again: 
    (repeat last action) 
    Your identification has been saved in ~/.ssh/id_rsa
    Your public key has been saved in ~/.ssh/id_rsa.pub
    The key fingerprint is:
    A long string appears here
    %
  • 2)
    Paste the content of the  ~/.ssh/id_dsa.pub file that just got generated on your local host into the file ~/.ssh/authorized_keys on the remote host and save.
  • 3)
    Set proper permissions on your local host keys and .ssh directory:
    chmod 700 ~/.ssh
    chmod 644 ~/.ssh/id_rsa.pub
    chmod 600 ~/.ssh/id_rsa
    set proper permissions on your remote host authorized_keys and .ssh directory
    chmod 700 ~/.ssh
    chmod 644 ~/.ssh/authorized_keys

How to find the 10 largest file or directories in Linux


This finds the largest 10 files :

find . -type f -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

This finds the largest 10 directories:

find . -type d -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

You can easily change -10 to -n where n is the number of files/directories you are trying to find.