Monthly Archives: April 2012

How to play flash videos with the media player of your choice

Notice: This method will probably not work on all YouTube videos.

Remember the good old days when you could pause a flash video, let it buffer and play the video with the media player of your choice by opening the corresponding file from the /tmp directory?

Well that’s still possible. However the video-files are deleted from the /tmp directory. So you need to find the PID of the flash plugin-container to open the video from /proc/PID/fd/.
Read the rest of this entry

How to login to ssh using public key authentication

First you have to create a public, private key pair. For this you can use the command-line tool sshkey-gen.

Change the directory to “~/.ssh” (create it, if it does not exist).
cd ~/.ssh

Create key pair
Now let’s create the key pair. In this example I will use RSA with 4096 Bit
ssh-keygen -t rsa -b 4096

Enter a passphrase if you want but you don’t have to. I recommend to enter a passphrase.

Transfer public key to ssh server
To transfer the public key to the ssh server you can use ssh-copy-id.
ssh-copy-id -i ~/.ssh/id_rsa.pub HOST

Login with key
Now you should be able to login with the created key.
ssh USERNAME@HOST

How to manage ssh host keys

Linux saves the ssh host keys in ~/.ssh/known_hosts. You can manage these ssh host keys with the command ssh-keygen.

Examples:
Search for a specific host (in known_hosts):
ssh-keygen -F HOSTNAME

Remove a specific host:
ssh-keygen -R HOSTNAME

To add a new ssh host key you can use ssh-keyscan. This command print the ssh host key on the stdout. So we have to append this key to the known_hosts file.
Example:
ssh-keyscan -H HOSTNAME >> ~/.ssh/known_hosts

How to encrypt and decrypt a file with openssl

Openssl comes with lots of cipher types. At the end of the post you can find a list of all cipher types.

Encryption

We want to encrypt the file test.txt with AES 256 Bit CBC. The name of the encrypted file is test.enc:

openssl enc -aes-256-cbc -in test.txt -out test.enc

Decryption

We want to decrypt the file test.enc with AES 256 Bit CBC:

openssl enc -d -aes-256-cbc -in test.enc -out test.txt

Openssl will ask you for the passphrase.

Read the rest of this entry

How to merge PDF files

You can use the Linux command-line too pdftk to merge several PDF files into one.

Example:
You have two PDF file a.pdf and b.pdf and want to merge these two files into one file named c.pdf.

pdftk a.pdf b.pdf cat output c.pdf

Another way to do this, is to use handles:

pdftk A=a.pdf B=b.pdf cat A B output c.pdf

Last update: 14.06.2015