Administrating Virtual System
Once you have created your VM, you can administrate it. Don't forget the security configuration part in order to have an up-to-date VM.
To connect the VM as root:
$ ssh -i ~/.novacreds/cloudkey user@ip
Note: for CentOS VM the user is centos and for Ubuntu is ubuntu.
If a network error occurs, check if the IP adress is reachable:
$ ping ip
If an error appends such as Permission denied (publickey)
, clean the local known_hosts
file:
$ vi ~/.ssh/known_hosts
To prevent security issues (example with a VM running CentOS 7):
Update first the packages for security purposes and configure the Epel repository (scientific packages).
root@vm $ yum -y update root@vm $ yum install -y epel-release
Install yum-cron service and configure it to update automatically security packages:
root@vm $ yum install -y yum-cron root@vm $ systemctl enable yum-cron root@vm $ sed -i 's|update_cmd = default|update_cmd=security|g' \ /etc/yum/yum-cron.conf root@vm $ sed -i 's|apply_updates = no|apply_updates = yes|g' \ /etc/yum/yum-cron.conf root@vm $ systemctl start yum-cron
To install packages (example with a VM running CentOS 7):
Install your specific libraries:
root@vm $ yum -y install gcc-gfortran make gnuplot
To create Smith user (only key pair is allowed for connexion):
root@vm $ useradd smith root@vm $ su smith smith@vm $ cd smith@vm $ mkdir .ssh smith@vm $ touch ~/.ssh/authorized_keys smith@vm $ chmod 600 ~/.ssh/authorized_keys
Put the ~/.ssh/id_rsa.pub
of Smith (local) in ~/.ssh/authorized_keys
(VM).
To connect as Smith:
$ ssh -i ~/.novacreds/cloudkey smith@ip
To transfert files (from MV to local):
$ scp -i ~/.novacreds/cloudkey smith@ip:Rep/*.txt .