Using docker to gain root

Lately I needed to remove some temporary files from a server that I only had limited user access to, and our administrator was occupied with some other task.

Luckily docker was running on the server and my user was part of the docker group, and so I started a standard Ubuntu image that mounted the server's root directory. Inside the container I modified /root/.ssh/authorized_keys and added my own SSH key. Now I could ssh as root onto the server and finish my task.

$ docker run --rm -it --volume=/:/host-root/ ubuntu:xenial bash

Written by Christian Weiske.

Comments? Please send an e-mail.