Session Prices

Feel free to negotiate depending on your situation.

Scheduling

Hit me up to work out a scheduled time and date.
[email protected]
213-995-7078 text or voice
Getting Setup For Remote Automation

A lot of what we'd like to focus on is remote automation. With that in mind, there are certain things that we should setup to make that all work more smoothly.

The first thing is setting up ssh to work with asymmetric keys. Asymmetric keys allow us to log in to a server using keys instead of passwords and allows us to automate things without having to type a password every single time.

To setup ssh to work with asym keys, we need a place to put the keys.

A good place is to store them is under your .ssh directory in your home directory.

Just in case you don't have a .ssh directory, let's create one (This has no effect if one already exists):

mkdir -p ~/.ssh

We need to run the command that generates the keys.

For this example, we'll press Enter for no passphrase. This will generate two files:

ssh-keygen -t rsa -f ~/.ssh/staging
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again: 
Your identification has been saved in staging
Your public key has been saved in staging.pub
The key fingerprint is:
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx dev@dev
The key's randomart image is:
+---[RSA 3072]----+
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
+----[SHA256]-----+

Now, in our directory, we'll have two new files:

ls -l
-rw------- 1 dev dev 2590 Jan 26 15:03 staging
-rw-r--r-- 1 dev dev  561 Jan 26 15:03 staging.pub

You'll notice that staging has very limited permissions -rw-------. This is because this is your private key. You need to keep this key private and secured. If someone gets this key, they can log into your server as if you've given them your password.

The other file, staging.pub has more lax permissions (-rw-r--r--). This is your public key. This file you can send to your server administrator to put on the server. You can email this file, with no security implications. If you run your own server, you can copy this file to your server, as you'll see in later lessons.

To summarize:

-rw------- 1 dev dev 2590 Jan 26 15:03 staging - Keep private
-rw-r--r-- 1 dev dev  561 Jan 26 15:03 staging.pub - Email to server administrator or copy to server

Once this has been completed, we need to add a setting to your ssh config file. This should be also be in your ~/.ssh directory. Adding this to your config file tells ssh that it can use these files to log in to a server.

To add this to your ssh config, run the following command:

cat >> ~/.ssh/config << EOF
Host staging
IdentityFile ~/.ssh/staging
IdentitiesOnly Yes

EOF

Press Enter to append the settings to your config file.

To double check that the settings were added, enter:

cat ~/.ssh/config
Host staging
IdentityFile ~/.ssh/staging
IdentitiesOnly Yes