Getting Basic Info Like Hostname and IP
(base) C:\Users\ashish>hostname CS3L (base) C:\Users\ashish>ipconfig Windows IP Configuration Ethernet adapter Ethernet 2: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : ad.itli.com Ethernet adapter Ethernet: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : ad.itli.com Wireless LAN adapter Wi-Fi: Connection-specific DNS Suffix . : IPv6 Address. . . . . . . . . . . : 2401:4900:47f2:5147:b1b2:6d59:f669:1b96 Temporary IPv6 Address. . . . . . : 2401:4900:47f2:5147:15e3:46:9f5b:8d78 Link-local IPv6 Address . . . . . : fe80::b1b2:6d59:f669:1b96%13 IPv4 Address. . . . . . . . . . . : 192.168.1.100 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : fe80::d837:1aff:fe40:b173%13 192.168.1.1 Ethernet adapter Bluetooth Network Connection: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . :Setting up SSH
(base) C:\Users\ashish>mkdir .ssh (base) C:\Users\ashish>dir Volume in drive C is OSDisk Volume Serial Number is ABCD-PQRS Directory of C:\Users\ashish 10/26/2022 03:25 PM <DIR> . 10/26/2022 03:25 PM <DIR> .. 08/16/2022 01:29 PM <DIR> .3T 09/26/2022 08:04 AM 1,288 .bash_history 06/02/2022 10:15 AM <DIR> .cache 05/30/2022 11:39 AM <DIR> .conda 10/26/2022 02:58 PM 89 .dotty_history 08/19/2022 06:42 PM 68 .gitconfig 10/11/2022 02:03 PM <DIR> .ipython 05/30/2022 10:05 AM <DIR> .jupyter 05/30/2022 12:56 PM <DIR> .keras 08/20/2022 11:55 AM 20 .lesshst 07/04/2022 06:09 PM <DIR> .matplotlib 06/30/2022 10:32 AM <DIR> .ms-ad 10/07/2022 09:00 PM 1,457 .python_history 10/26/2022 03:25 PM <DIR> .ssh 09/06/2022 10:13 PM 2,379 .viminfo 05/30/2022 11:34 AM <DIR> .vscode 05/16/2022 03:19 PM <DIR> 3D Objects 10/07/2022 02:50 PM <DIR> Anaconda3 05/16/2022 03:19 PM <DIR> Contacts 10/26/2022 02:57 PM <DIR> Desktop 10/07/2022 06:27 PM <DIR> Documents 10/26/2022 03:18 PM <DIR> Downloads 05/16/2022 03:19 PM <DIR> Favorites 05/16/2022 03:19 PM <DIR> Links 05/16/2022 03:19 PM <DIR> Music 05/16/2022 02:13 PM <DIR> OneDrive 05/16/2022 03:20 PM <DIR> Pictures 05/16/2022 03:19 PM <DIR> Saved Games 05/16/2022 03:20 PM <DIR> Searches 05/30/2022 09:36 AM <DIR> Videos 6 File(s) 5,301 bytes 26 Dir(s) 81,987,842,048 bytes free (base) C:\Users\ashish>cd .ssh (base) C:\Users\ashish\.ssh>dir Volume in drive C is OSDisk Volume Serial Number is ABCD-PQRS Directory of C:\Users\ashish\.ssh 10/26/2022 03:25 PM <DIR> . 10/26/2022 03:25 PM <DIR> .. 0 File(s) 0 bytes 2 Dir(s) 81,987,903,488 bytes free (base) C:\Users\ashish\.ssh>echo "" > id_rsa (base) C:\Users\ashish\.ssh>dir Volume in drive C is OSDisk Volume Serial Number is ABCD-PQRS Directory of C:\Users\ashish\.ssh 10/26/2022 03:26 PM <DIR> . 10/26/2022 03:26 PM <DIR> .. 10/26/2022 03:26 PM 5 id_rsa 1 File(s) 5 bytes 2 Dir(s) 81,987,678,208 bytes free (base) C:\Users\ashish\.ssh>type id_rsa (base) C:\Users\ashish\.ssh> (base) C:\Users\ashish>ssh-keygen -t rsa -f ./.ssh/id_rsa -P "" Generating public/private rsa key pair. ./.ssh/id_rsa already exists. Overwrite (y/n)? y Your identification has been saved in ./.ssh/id_rsa. Your public key has been saved in ./.ssh/id_rsa.pub. The key fingerprint is: SHA256:fGEZHROeTzogrdXwo7haw0g3eXLVZnO9nM0ZtTbIBh8 itlitli\ashish@CS3L The key's randomart image is: +---[RSA 3072]----+ | oo+E .| | . B=+o +| | . B B=*=o| | . B =.Bo+B| | . S = o .=o| | . + B . | | . = | | o . | | . | +----[SHA256]-----+ (base) C:\Users\ashish>Note This Error While Doing Setup on Windows
CMD> ssh-copy-id -i ./.ssh/id_rsa.pub ashish@192.168.1.100 'ssh-copy-id' is not recognized as an internal or external command, operable program or batch file.We overcome this issue by manually copying Public RSA Key into the 'authorized_keys' file of the remote machine using SFTP.
(base) C:\Users\ashish>sftp usage: sftp [-46aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher] [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-J destination] [-l limit] [-o ssh_option] [-P port] [-R num_requests] [-S program] [-s subsystem | sftp_server] destinationNext Steps of Copying Pubic Key Onto Remote Machine And Vice-versa
Address of Ubuntu System: ashish@192.168.1.151
(base) C:\Users\ashish>sftp ashish@192.168.1.151 The authenticity of host '192.168.1.151 (192.168.1.151)' can't be established. ECDSA key fingerprint is SHA256:2hgOVHHgkrT9/6XnK/KDaFQ0DaXLUoW82eeU6oQyTvQ. Are you sure you want to continue connecting (yes/no/[fingerprint])? Warning: Permanently added '192.168.1.151' (ECDSA) to the list of known hosts. ashish@192.168.1.151's password: Connected to 192.168.1.151. sftp> ls Desktop Documents Downloads Music Pictures Public Templates Videos anaconda3 nltk_data snap sftp> byePWD: /home/ashish
sftp> put id_rsa.pub win_auth_key.txt Uploading id_rsa.pub to /home/ashish/win_auth_key.txt id_rsa.pub 100% 593 89.9KB/s 00:00 sftp>PWD: /home/ashish/.ssh
sftp> get id_rsa.pub ./ubuntu_id_rsa.pub.txt Fetching /home/ashish/.ssh/id_rsa.pub to ./ubuntu_id_rsa.pub.txt /home/ashish/.ssh/id_rsa.pub 100% 573 2.7KB/s 00:00 sftp> sftp> byeSteps on Ubuntu Machine
(base) ashish@ashishlaptop:~$ cat win_auth_key.txt ssh-rsa AAA***vZs= itli\ashish@CS3L (base) ashish@ashishlaptop:~$Paste this Public RSA Key in 'authorized_keys' File
(base) ashish@ashishlaptop:~/.ssh$ nano authorized_keys (base) ashish@ashishlaptop:~/.ssh$ cat authorized_keys ssh-rsa AAAA***rzFM= ashish@ashishdesktop ssh-rsa AAAA***GOD0= ashish@ashishlaptop ssh-rsa AAAA***3vZs= itli\ashish@CS3L (base) ashish@ashishlaptop:~/.ssh$Testing The SSH
Back to Windows 10 System
(base) C:\Users\ashish>ssh ashish@ashishlaptop The authenticity of host 'ashishlaptop (192.168.1.151)' can't be established. ECDSA key fingerprint is SHA256:2hgOVHHgkrT9/6XnK/KDaFQ0DaXLUoW82eeU6oQyTvQ. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'ashishlaptop' (ECDSA) to the list of known hosts. Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-52-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 2 updates can be applied immediately. To see these additional updates run: apt list --upgradable Last login: Wed Oct 26 13:35:44 2022 from 192.168.1.151 (base) ashish@ashishlaptop:~$ (base) ashish@ashishlaptop:~$ ls anaconda3 Desktop Documents Downloads Music nltk_data Pictures Public snap Templates Videos win_auth_key.txt (base) ashish@ashishlaptop:~$ rm win_auth_key.txt (base) ashish@ashishlaptop:~$ ls anaconda3 Desktop Documents Downloads Music nltk_data Pictures Public snap Templates Videos (base) ashish@ashishlaptop:~$ exit logout Connection to ashishlaptop closed. (base) C:\Users\ashish>ssh ashish@ashishlaptop Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-52-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 2 updates can be applied immediately. To see these additional updates run: apt list --upgradable Last login: Wed Oct 26 15:46:02 2022 from 192.168.1.100 (base) ashish@ashishlaptop:~$ client_loop: send disconnect: Connection reset (base) C:\Users\ashish>
Showing posts with label SSH. Show all posts
Showing posts with label SSH. Show all posts
Wednesday, October 26, 2022
SSH Setup For Accessing Ubuntu From Windows Using SFTP
Thursday, October 13, 2022
SSH Setup (on two Ubuntu machines), Error Messages and Resolution
Tags: Technology,Linux,SSH,System 1: ashishlaptop
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~$ ifconfig enp1s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether 9c:5a:44:09:35:ee 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 375 bytes 45116 (45.1 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 375 bytes 45116 (45.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.131 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::5154:e768:24e1:aece prefixlen 64 scopeid 0x20<link> inet6 2401:4900:47f6:d7d1:b724:d299:1a51:567 prefixlen 64 scopeid 0x0<global> inet6 2401:4900:47f6:d7d1:239a:fc2d:c994:6e54 prefixlen 64 scopeid 0x0<global> ether b0:fc:36:e5:ad:11 txqueuelen 1000 (Ethernet) RX packets 7899 bytes 8775440 (8.7 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 5299 bytes 665165 (665.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~$ hostname ashish-Lenovo-ideapad-130-15IKBTo Change The Hostname
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~$ sudo nano /etc/hostname (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~$ cat /etc/hostname ashishlaptopSystem restart required at this point for new hostname to reflect everywhere.
To Setup Addressing of Connected Nodes and Their IP Addresses
Original File Contents
(base) ashish@ashishlaptop:~$ cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 ashish-Lenovo-ideapad-130-15IKB # 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-allroutersFile "/etc/hosts" After Change
(base) ashish@ashishlaptop:~$ sudo nano /etc/hosts (base) ashish@ashishlaptop:~$ cat /etc/hosts 192.168.1.131 ashishlaptop 192.168.1.106 ashishdesktopChecking Connectivity With The Other Machine
(base) ashish@ashishlaptop:~$ ping 192.168.1.106 PING 192.168.1.106 (192.168.1.106) 56(84) bytes of data. 64 bytes from 192.168.1.106: icmp_seq=1 ttl=64 time=5.51 ms 64 bytes from 192.168.1.106: icmp_seq=2 ttl=64 time=115 ms 64 bytes from 192.168.1.106: icmp_seq=3 ttl=64 time=4.61 ms 64 bytes from 192.168.1.106: icmp_seq=4 ttl=64 time=362 ms 64 bytes from 192.168.1.106: icmp_seq=5 ttl=64 time=179 ms 64 bytes from 192.168.1.106: icmp_seq=6 ttl=64 time=4.53 ms ^C --- 192.168.1.106 ping statistics --- 6 packets transmitted, 6 received, 0% packet loss, time 5012ms rtt min/avg/max/mdev = 4.525/111.739/361.954/129.976 msSystem 2: ashishdesktop
(base) ashish@ashishdesktop:~$ ifconfig ens33: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether 00:e0:4c:3c:16:6b 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 317 bytes 33529 (33.5 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 317 bytes 33529 (33.5 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlx00e02d420fcb: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.106 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 2401:4900:47f6:d7d1:3cc9:20f6:af75:bb28 prefixlen 64 scopeid 0x0<global> inet6 2401:4900:47f6:d7d1:73e6:fca0:4452:382 prefixlen 64 scopeid 0x0<global> inet6 fe80::1cdd:53e7:d13a:4f52 prefixlen 64 scopeid 0x20<link> ether 00:e0:2d:42:0f:cb txqueuelen 1000 (Ethernet) RX packets 42484 bytes 56651709 (56.6 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 28763 bytes 3324595 (3.3 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 (base) ashish@ashishdesktop:~$ hostname ashishdesktopOriginal Contents of File "/etc/hosts"
(base) ashish@ashishdesktop:~$ cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 ashishdesktop # 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-allroutersModified Contents of "/etc/hosts"
(base) ashish@ashishdesktop:~$ sudo nano /etc/hosts (base) ashish@ashishdesktop:~$ cat /etc/hosts 192.168.1.106 ashishdesktop 192.168.1.131 ashishlaptopSSH Commands
First: Follow steps 1 to 7 on every node.
1) sudo apt-get install openssh-server openssh-client 2) sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT 3) Use the network adapter 'NAT' in the Guest OS settings, and create a new port forwarding rule "SSH" for port 22. 4) sudo reboot 5) ssh-keygen -t rsa -f ~/.ssh/id_rsa -P "" 6) sudo service ssh stop 7) sudo service ssh startSecond: After 'First' is done, follow steps 8 to 10 on every node.
8) ssh-copy-id -i ~/.ssh/id_rsa.pub ashish@master 9) ssh-copy-id -i ~/.ssh/id_rsa.pub ashish@slave1 10) ssh-copy-id -i ~/.ssh/id_rsa.pub ashish@slave2Error Messages And Resolutions
Error 1: Port 22: Connection refused
(base) ashish@ashishlaptop:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub ashish@ashishdesktop /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ashish/.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 ashishdesktop port 22: Connection refusedResolution
First follow SSH steps 1 to 7 on both the machines.Error 2: Could not resolve hostname ashishlaptop
(base) ashish@ashishdesktop:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub ashish@ashishlaptop /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ashish/.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: Could not resolve hostname ashishlaptop: Temporary failure in name resolutionResolution
Modify contents of two files "/etc/hostname" and "/etc/hosts" as shown above as the starting activity for this task.
Tuesday, February 1, 2022
Debugging SSH Setup for two RHEL systems
ISSUE: SLAVE1 IS NOT ABLE TO CONNECT WITH SLAVE2 VIA SSH WITHOUT PASSWORD PROMPT. IP AND HOSTNAME MAPPING: 10.74.19.50 MASTER 10.138.22.103 SLAVE1 10.85.62.107 SLAVE2 COMMANDS FOR DOING SSH SETUP: 1) sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT 2) sudo reboot 3) ssh-keygen -t rsa -f ~/.ssh/id_rsa -P "" 4) ssh-copy-id -i ~/.ssh/id_rsa.pub projadmin@SLAVE2 5) ssh-copy-id -i ~/.ssh/id_rsa.pub admin@SLAVE1 6) ssh-copy-id -i ~/.ssh/id_rsa.pub admin@MASTER ~~ ~~ ~~ Command "ssh-copy-id" is used to copy your SSH public key to remote server for password less authentication. MESSAGE YOU GET WHEN SSH KEYS ARE ALREADY PRESENT ON THE REMOTE SYSTEM: (base) [projadmin@SLAVE2 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub admin@SLAVE1 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/projadmin/.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: WARNING: All keys were skipped because they already exist on the remote system. (if you think this is a mistake, you may want to use -f option) ~~ ~~ ~~ MESSAGE YOU GET WHEN SSH KEYS ARE COPIED ON THE REMOTE SYSTEM: (base) [admin@SLAVE1 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub projadmin@SLAVE2 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/admin/.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: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys IT IS AN OFFENSE TO CONTINUE WITHOUT PROPER AUTHORIZATION. projadmin@SLAVE2's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'projadmin@SLAVE2'" and check to make sure that only the key(s) you wanted were added. LOGIN ATTEMPT 1: (base) [admin@SLAVE1 ~]$ ssh 'projadmin@SLAVE2' The authenticity of host 'slave2 (10.85.62.107)' can't be established. ECDSA key fingerprint is SHA256:+BqTUw27qVUgqcYRErYL8nksgX4XX9cimu/sgk2IkRs. ECDSA key fingerprint is MD5:27:41:cd:39:f2:97:a9:29:6b:e8:8b:f3:e6:aa:cd:8e. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'slave2' (ECDSA) to the list of known hosts. IT IS AN OFFENSE TO CONTINUE WITHOUT PROPER AUTHORIZATION. projadmin@slave2's password: Last login: Fri May 1 11:56:39 2020 from SLAVE1 W A R N I N G THIS IS A PRIVATE COMPUTING SYSTEM FOR USE ONLY BY AUTHORIZED USERS. (base) [projadmin@SLAVE2 ~]$ LOGIN ATTEMPT 2: (base) [admin@SLAVE1 ~]$ ssh 'projadmin@SLAVE2' IT IS AN OFFENSE TO CONTINUE WITHOUT PROPER AUTHORIZATION. projadmin@slave2's password: Last login: Fri May 1 12:01:02 2020 from SLAVE1 W A R N I N G THIS IS A PRIVATE COMPUTING SYSTEM FOR USE ONLY BY AUTHORIZED USERS. (base) [projadmin@SLAVE2 ~]$ ~~ ~~ ~~ SSH PUBLIC KEYS ARE STORED IN REMOTE SERVER'S FILE "~/.ssh/authorized_keys". NEXT, WE DISPLAY THAT: (base) [projadmin@SLAVE2 ~]$ cat ~/.ssh/authorized_keys ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAaG5d2wcXeVGQkTtiHr5EQD5nYPugU1upCAnsei8vuZ1LpoUdrCiFq0jkvnQCOa... admin@MASTER ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDckTRtXhW3JlQ/dgR3cEn70MGUNU29DT438ItypXh+BRnGTSuFayGLLb7XfgR4Fg... projadmin@SLAVE2 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCb/WDdGt0abaEI9aTljhgtRYtzrjjAJu3+GK3wbmjFMTvvlb5729l4kcUwg3IeAv... admin@SLAVE1 NEXT, WE CHECK OUR PUBLIC KEY OF SLAVE1: (base) [admin@SLAVE1 ~]$ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCb/WDdGt0abaEI9aTljhgtRYtzrjjAJu3+GK3wbmjFMTvvlb5729l4kcUwg3IeAv... admin@SLAVE1 ~~ ~~ ~~ NEXT, WE CHECK SSH CONFIG ON SLAVE2: (base) [admin@SLAVE1 ~]$ cat ~/.ssh/config cat: /home/admin/.ssh/config: No such file or directory (base) [admin@SLAVE1 ~]$ (base) [projadmin@SLAVE2 ~]$ ssh-agent SSH_AUTH_SOCK=/tmp/ssh-1ULxPy4vidVX/agent.5929; export SSH_AUTH_SOCK; SSH_AGENT_PID=5930; export SSH_AGENT_PID; echo Agent pid 5930; NEXT, WE CHECK SSH CONFIG ON SLAVE2: (base) [projadmin@SLAVE2 .ssh]$ ls authorized_keys id_rsa id_rsa.pub known_hosts (base) [projadmin@SLAVE2 .ssh]$ cat known_hosts SLAVE1,10.138.22.103 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTIt...rObCVOxrV5XaKARNHQA= slave1 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTIt...rbCVOxrV5XaKARNHQA= SLAVE2,10.85.62.107 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoY...Xg6hmPnlGbfIiVmVPNdU= slave2 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbm...ArObCVOxrV5XaKARNHQA= 10.74.19.50 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYT...rObCVOxrV5XaKARNHQA= MASTER ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTIt...ArObCVOxrV5XaKARNHQA= master ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTI...hmPnlGbfIiVmVPNdU= localhost ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoY...mPnlGbfIiVmVPNdU= CREATING 'CONFIG' FILE SINCE IT DOES NOT EXIST: (base) [projadmin@SLAVE2 .ssh]$ touch config (base) [projadmin@SLAVE2 .ssh]$ ls authorized_keys config id_rsa id_rsa.pub known_hosts (base) [projadmin@SLAVE2 .ssh]$ vi config (base) [projadmin@SLAVE2 .ssh]$ cat config Host * UseKeychain yes AddKeysToAgent yes IdentityFile ~/.ssh/id_rsa (base) [projadmin@SLAVE2 ~]$ ssh-add -A Could not open a connection to your authentication agent. (base) [projadmin@SLAVE2 ~]$ ~~ ~~ ~~ (base) [projadmin@SLAVE2 ~]$ eval `ssh-agent -s` Agent pid 5182 (base) [projadmin@SLAVE2 ~]$ ssh-add -K ~/.ssh/id_rsa unknown option -- K usage: ssh-add [options] [file ...] Options: -l List fingerprints of all identities. -E hash Specify hash algorithm used for fingerprints. -L List public key parameters of all identities. -k Load only keys and not certificates. -c Require confirmation to sign using identities -t life Set lifetime (in seconds) when adding identities. -d Delete identity. -D Delete all identities. -x Lock agent. -X Unlock agent. -s pkcs11 Add keys from PKCS#11 provider. -e pkcs11 Remove keys provided by PKCS#11 provider. (base) [projadmin@SLAVE2 ~]$ ssh-add -k ~/.ssh/id_rsa Identity added: /home/projadmin/.ssh/id_rsa (/home/projadmin/.ssh/id_rsa) (base) [projadmin@SLAVE2 ~]$ (base) [projadmin@SLAVE2 .ssh]$ eval `ssh-agent -s` Agent pid 5611 (base) [projadmin@SLAVE2 .ssh]$ ssh-add ~/.ssh/id_rsa Identity added: /home/projadmin/.ssh/id_rsa (/home/projadmin/.ssh/id_rsa) ~~ ~~ ~~ LAST RESORT: Deleting the everything in the directory: projadmin@SLAVE2:/home/projadmin/.ssh Copying public key only again from slave1: (base) [admin@SLAVE1 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub projadmin@SLAVE2 The issue still exists. Not able to SSH slave2 from slave1 without password prompt. ~~ ~~ ~~ STATUS: ISSUE UNRESOLVED References: 1. SSH Setup: Remote machine still asking for password (Stackoverflow) 2. Copying SSH key to remote serverTags: Technology,Linux,SSH
Subscribe to:
Posts (Atom)