Utility Bash script to setup key based ssh access quickly

I needed to add my public key to a couple of servers the same day. After having done it twice, I thought of writing a bash script to pull my key from a public url at dropbox and append it to the authorized_keys file on the server. It appends to the same user who I am logged in as.

You can build on this if you find yourself doing something similar repetitively.

sudo: giving previlige to non previliged users

On *nix systems, there are certain tasks such as running servers, editing sensitive resource or configuration files that only privileged users can do.

During software development phase, many such tasks need to be repeated often, and the application developer needs to request the system administrator each time. Sudo is a perfect tool for such times. ( atleast that is how I came across it)

The root user can specify users or group, and command which they can execute in the /etc/sudoers file. The non previliged user can then use sudo to run commands as previliged users, without loggin in as one. (without the need to know the previliged user’s password that is). Root users should use visudo to edit the /etc/sudoers file. Visudo parses the file for any syntax error.

An additional benefit of using sudo is that it logs each time a user tries to run a sudo command.

You can read more about sudo here or do a man sudo.