USER: MANJU
1. manju@manju-desktop:~/Desktop$ sudo nano /etc/hostname [sudo] password for manju: manju@manju-desktop:~/Desktop$ cat /etc/hostname manju2.
manju@manju:~/Desktop$ hostname manju manju@manju:~/Desktop$ sudo nano /etc/hosts [sudo] password for manju: manju@manju:~/Desktop$ cat /etc/hosts 192.168.1.103 manju 192.168.1.101 ashish manju@manju:~/Desktop$ sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT manju@manju:~/Desktop$ ssh-keygen -t rsa -f ~/.ssh/id_rsa -P "" Generating public/private rsa key pair. Created directory '/home/manju/.ssh'. Your identification has been saved in /home/manju/.ssh/id_rsa Your public key has been saved in /home/manju/.ssh/id_rsa.pub The key fingerprint is: SHA256:87t+....JyZl5NvSEYYvM manju@manju The key's randomart image is: +---[RSA 3072]----+ ... | ..+ | | .++ | +----[SHA256]-----+ manju@manju:~/Desktop$ ssh-copy-id -i ~/.ssh/id_rsa.pub ashish@ashish /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/manju/.ssh/id_rsa.pub" /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: ERROR: ssh: connect to host ashish port 22: No route to host 3. manju@manju:~$ sudo apt-get install openssh-server manju@manju:~$ sudo reboot4.
manju@manju:~$ ping 192.168.1.104 PING 192.168.1.104 (192.168.1.104) 56(84) bytes of data. 64 bytes from 192.168.1.104: icmp_seq=1 ttl=64 time=87.5 ms 64 bytes from 192.168.1.104: icmp_seq=2 ttl=64 time=3.47 ms ^C --- 192.168.1.104 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1002ms rtt min/avg/max/mdev = 3.466/45.488/87.510/42.022 ms manju@manju:~$ sudo nano /etc/hosts [sudo] password for manju: manju@manju:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub ashish@ashish /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/manju/.ssh/id_rsa.pub" The authenticity of host 'ashish (192.168.1.104)' can't be established. ECDSA key fingerprint is SHA256:gSl4hdqrq8...WVRO0. Are you sure you want to continue connecting (yes/no/[fingerprint])? 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 ashish@ashish's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'ashish@ashish'" and check to make sure that only the key(s) you wanted were added. manju@manju:~$USER: ASHISH
1. ashish@ashish-Vostro-1014:~/Desktop$ cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 ashish-Vostro-1014 # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 2. ashish@ashish:~/Desktop$ cat /etc/hostname ashish ashish@ashish:~/Desktop$ hostname ashish ashish@ashish:~/Desktop$ ashish@ashish:~/Desktop$ ifconfig enp9s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether 14:fe:b5:a2:4f:ec txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 203 bytes 17205 (17.2 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 203 bytes 17205 (17.2 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlp12s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.101 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 2401:4900:47fc:ff81:4d50:2f1b:8e0d:4ab3 prefixlen 64 scopeid 0x0<global> inet6 2401:4900:47fc:ff81:69fb:546c:eed4:ba63 prefixlen 64 scopeid 0x0<global> inet6 fe80::6e0:63ce:56e8:94bc prefixlen 64 scopeid 0x20<link> ether ec:55:f9:13:78:d3 txqueuelen 1000 (Ethernet) RX packets 93 bytes 19289 (19.2 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 182 bytes 29336 (29.3 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 3. ashish@ashish:~/Desktop$ sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT [sudo] password for ashish: ashish@ashish:~/Desktop$ ssh-keygen -t rsa -f ~/.ssh/id_rsa -P "" Generating public/private rsa key pair. /home/ashish/.ssh/id_rsa already exists. Overwrite (y/n)? y Your identification has been saved in /home/ashish/.ssh/id_rsa Your public key has been saved in /home/ashish/.ssh/id_rsa.pub The key fingerprint is: SHA256:WNJqmuUwAR/PGRaM...c68dg ashish@ashish The key's randomart image is: +---[RSA 3072]----+ ... | +.+=. | | o.o+.E | |oo.o**. | +----[SHA256]-----+ 4. ashish@ashish:~$ cat /etc/hosts 192.168.1.101 ashish 192.168.1.103 manju ashish@ashish:~$ ashish@ashish:~$ sudo reboot 5. ashish@ashish:~$ sudo apt-get install openssh-server 6. ashish@ashish:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub manju@manju /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ashish/.ssh/id_rsa.pub" The authenticity of host 'manju (192.168.1.103)' can't be established. ECDSA key fingerprint is SHA256:4lS4BWY6l7I0A2pQ6RiSB6PMskHiy1oNVPozB/6jkIc. Are you sure you want to continue connecting (yes/no/[fingerprint])? 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 manju@manju's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'manju@manju'" and check to make sure that only the key(s) you wanted were added. 7. ashish@ashish:~$ ssh manju@manju Welcome to Ubuntu 21.04 (GNU/Linux 5.11.0-49-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 65 updates can be applied immediately. To see these additional updates run: apt list --upgradable Your Ubuntu release is not supported anymore. For upgrade information, please visit: http://www.ubuntu.com/releaseendoflife New release '21.10' available. Run 'do-release-upgrade' to upgrade to it.
Tuesday, February 1, 2022
SSH Setup on Two Ubuntu Machines
Labels:
Linux,
Technology
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment