Changes

Jump to: navigation, search

OPS435 Python3 Lab 8

2,546 bytes added, 12:41, 3 July 2020
PART II: Connect to VM in myvmlab.senecacollege.ca
Last login: Fri Jul 3 11:06:24 2020 from mtrx-node05pd.dcm.senecacollege.ca
</pre>
: Once you are on your VM, try the following commands and record the results for later comparison with the results of other commands:<source lang='bash'>
[student@centos7 ~]$ hostname
centos7
[student@centos7 ~]$ id
uid=1002(student) gid=1002(student) groups=1002(student),10(wheel)
[student@centos7 ~]$ df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 878260 0 878260 0% /dev
tmpfs 889792 0 889792 0% /dev/shm
tmpfs 889792 9492 880300 2% /run
tmpfs 889792 0 889792 0% /sys/fs/cgroup
/dev/mapper/centos-root 38680112 1745524 36934588 5% /
/dev/sda2 1038336 331228 707108 32% /boot
/dev/sda1 204580 11296 193284 6% /boot/efi
/dev/mapper/centos-home 18880512 33160 18847352 1% /home
tmpfs 177960 0 177960 0% /run/user/1002
</source>
:Logout from your VM and get back to matrix.
:The previous SSH command when execute successfully, with create a login shell on the remote machine. If the previous SSH command is followed by specific bash command, it will be executed on the remote host instead of a login shell:<source lang='bash'>
[raymond.chan@mtrx-node05pd lab8]$ ssh -p 7211 student@myvmlab.senecacollege.ca 'hostname;id;df'
student@myvmlab.senecacollege.ca's password:
centos7
uid=1002(student) gid=1002(student) groups=1002(student),10(wheel)
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 878260 0 878260 0% /dev
tmpfs 889792 0 889792 0% /dev/shm
tmpfs 889792 9492 880300 2% /run
tmpfs 889792 0 889792 0% /sys/fs/cgroup
/dev/mapper/centos-root 38680112 1745608 36934504 5% /
/dev/sda2 1038336 331228 707108 32% /boot
/dev/sda1 204580 11296 193284 6% /boot/efi
/dev/mapper/centos-home 18880512 33160 18847352 1% /home
tmpfs 177960 0 177960 0% /run/user/1002
</source>
:Compare the outputs above with the previous results from executing the corresponding commands in the login shell.
:Please note that you were asked to provide the user's password for each SSH connection.
==Part III: Set up SSH login with public key authentication ==
: In order for your controller workstation to automate tasks execution on your VM, you will need to be able to connect to it using SSH public key authentication instead of using password authentication. You've done this in both OPS235 and OPS335, and here is summary on how to do it between your account on matrix and your VM:
=== Set up SSH key login ===: In order for an automated system to be able to connect to your VM and administer it - you will need to be able to connect to it using SSH keys. You've done this in both OPS235 and OPS335. : Create a new SSH key pair (one private, and one public) under your account on your main VM with your '''regular user''' (don't do it under root)matrix.senecacollege.ca. : Once you have both keys, set things up so that:* your regular user on your you can use the '''controller VMssh-copy-id''' can SSH command to copy your public key to the worker student account on your VM as the same regular user without prompting for a password:<source lang='bash'>ssh-copy-id -i ~/.ssh/id_rsa.pub -p 7200 student@myvmlab. (iesenecacollege. ca</source>: The above command should add the contents of your pub key to ~/.ssh/authorized_keys)under your student account on your VM.:* Verify and confirm that your regular user account on your '''controller VM''' matrix can SSH to the worker your VM as root 'student' without propmting prompting for a password. (ie. add the contents of your pub key to /root/.ssh/authorized_keys)
== PART 3 - Clone the Workers ==
1,760
edits

Navigation menu