Skip to content

Instantly share code, notes, and snippets.

View ajanthanblog's full-sized avatar

Ajanthan ajanthanblog

View GitHub Profile
sl-ajanthan@slajanthan-Latitude-3580:~/ansible$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/sl-ajanthan/.ssh/id_rsa): id_rsa_ansible
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa_ansible.
Your public key has been saved in id_rsa_ansible.pub.
The key fingerprint is:
SHA256:BwkRX9+JxkXtc0DrQOXo1soEFn9si2I4Bp3aWcTDnTU sl-ajanthan@slajanthan-Latitude-3580
The key's randomart image is:
ajanthe@ajanthe-VirtualBox:~/.ssh$ touch authorized_keys
ajanthe@ajanthe-VirtualBox:~/.ssh$
ajanthe@ajanthe-VirtualBox:~/.ssh$
ajanthe@ajanthe-VirtualBox:~/.ssh$
ajanthe@ajanthe-VirtualBox:~/.ssh$ chmod 700 authorized_keys
ajanthe@ajanthe-VirtualBox:~/.ssh$
ajanthe@ajanthe-VirtualBox:~/.ssh$
ajanthe@ajanthe-VirtualBox:~/.ssh$ ls -l
total 0
-rwx------ 1 ajanthe ajanthe 0 සැප් 10 11:37 authorized_keys
sudo apt-get install openssh-server
ajanthe@ajanthe-VirtualBox:~$ sudo apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ncurses-term openssh-sftp-server ssh-import-id
Suggested packages:
molly-guard monkeysphere rssh ssh-askpass
The following NEW packages will be installed:
ncurses-term openssh-server openssh-sftp-server
sl-ajanthan@slajanthan-Latitude-3580:~/ansible$ telnet 192.168.56.101 22
Trying 192.168.56.101...
Connected to 192.168.56.101.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
sl-ajanthan@slajanthan-Latitude-3580:~/ansible$ ssh-copy-id -i id_rsa_ansible.pub ajanthe@192.168.56.101
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_rsa_ansible.pub"
The authenticity of host '192.168.56.101 (192.168.56.101)' can't be established.
ECDSA key fingerprint is SHA256:0//XEhrQJAOJqbI9AuyC6ZWhB6WghvpPWVzuZfBQx/k.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
ajanthe@192.168.56.101's password:
Number of key(s) added: 1
ajanthe@ajanthe-VirtualBox:~/.ssh$ cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMZVI3y0FtiviWsmTcKVFvH5iJdKSARNp7u/Xz8KYpF+SY+qgfKW/b+3icV0NVvRfllQRJx+hfgCcxPo5WoDaQY8kGvp0/YwCogI3jP6Wt2lJnhbNJUA9ULuup2gqPXrWlA//zLJ85zY41NnWJasea1zqCHX6BBwMzwMwsuzMbq1r+IsVshCn0l0ytMT3meuhWaTLgs2LLtnToxbN7zodF+uSMZkxD5uFrMaY+yM0s99kH5eVsrjfqeguk+LHndWa6nwVA4VYHUy3LP+5GRlEVkL1+SKSjsguCJYnHIHM2SXpzVTFSqRhN1eHiCeAvF/G2vXLldZ5GqPLYcv76fQc7 sl-ajanthan@slajanthan-Latitude-3580
ajanthe@ajanthe-VirtualBox:~/.ssh$
sl-ajanthan@slajanthan-Latitude-3580:~/ansible$ ssh -i id_rsa_ansible ajanthe@192.168.56.101
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 5.0.0-23-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
* Canonical Livepatch is available for installation.
- Reduce system reboots and improve kernel security. Activate at:
production # inventory file for production servers
staging # inventory file for staging environment
group_vars/
group1.yml # here we assign variables to particular groups
group2.yml
host_vars/
hostname1.yml # here we assign variables to particular systems
hostname2.yml
inventories/
production/
hosts # inventory file for production servers
group_vars/
group1.yml # here we assign variables to particular groups
group2.yml
host_vars/
hostname1.yml # here we assign variables to particular systems
hostname2.yml