Automation Lab - kerryallen89/SYS-255-01 GitHub Wiki
Automation Lab
Deliverable 1. Perform multiple routine testing for connectivity and name resolution via 1-liners similar to the below screen:
This screenshot above shows the three command prompts on clone01-kerry, clone02-kerry, and clone03-kerry. The command was whoami; hostname; hostname -i; nslookup ad02-kerry | grep -i name; ping -c1 ad02-kerry | grep "packets transmitted"
Deliverable 2. ssh into either clone2 or clone3 using your ssh key. The passphrase you enter is only for unlocking your local private key on clone1, as opposed to logging into the remote system itself. Provide a screenshot that shows the prompt for your passphrase as well as the login into clone2 or 3 that does not ask for a password.
The screenshot above shows me ssh-ing into kerry@clone02-kerry from root@clone1-kerry. But instead of asking for the password for kerry@clone02-kerry, it asks for the passphrase for the key I created which is located in **_'/root/.ssh/id_rsa'.
Beforehand, I had done this on "root@clone01-kerry" so it might show in the logs along side kerry@clone01-kerry. But I went back to do it on a non-root user as I may have thought I messed up a future step do to it.
Deliverable 3. Provide a screenshot showing passwordless login to clone2 or 3 after having loaded the ssh-agent and private key.
The screenshot above shows the commands I put in to extend the time of the ssh session and to ssh into the other two clone VMs. Originally, trying to extend the time of the ssh session would not work. It would output that it Could not open a connection to your authentication agent. I came to a solution that by typing in the command exec ssh-agent bash found on stackoverflow. I believe this command allows for you to access the ssh-agent, as whoever came up with the solution didn't show an explanation. (CREDIT: https://stackoverflow.com/a/20403535) After entering that command, everything worked and I was able to extend the time of the ssh session, and was able to log in without passwords for only kerry@clone02-kerry as shown below.
I went back to see why I wasn't able to log into kerry@clone03-kerry without a password and I saw that I only added the private key to my clone02-kerry VM. So I added the key to kerry@clone03-kerry and this was the output.
After putting in the commands to enable the server and all of the other commands I have done previously with getting this to work, I finally got kerry@clone03-kerry to be able to be logged into without a password.
Editing /etc/sudoers
In the next step, I have to edit the file "/etc/sudoers"* and I am going to uncomment the line wheel ALL=(ALL) NOPASSWD: ALL. What this line does is that it lets me elevate to root without having to retype a password if the current user that I am in is in the wheel group. Its more of a quality of life change rather than a crucial change, but for the lab it is a deliverable.
make sure to be in root access when you do this as the file will not show up if you aren't, I made that mistake at first.
SHOWN ON KERRY@CLONE03-KERRY
SHOWN ON KERRY@CLONE02-KERRY
Deliverable 4. Provide a screenshot similar to the one below that shows passwordless access to clone2 or clone3 and elevation to root without retyping a password.
After modifying the /etc/sudoers file to allow users who are in the wheel group to elevate to root without having to retype their password, here it is shown in kerry@clone02-kerry.
Deliverable 5. Review the man page for pssh and construct a pssh hosts file containing your clone2 and clone3. Then execute the following non-privileged and privileged commands displaying inline standard output & errors as each host completes. Provide screenshots showing the command and [SUCCESS OUTPUT] for all four commands:
- uptime
- uname -a
- sudo yum -y install tree
- tree /etc/yum.repos.d/
I decided to create file called "hostfile.txt" with both clone02-kerry and clone03-kerry as shown below.