How To Unix:- Setting up client machines to connect by SSH/SFTP
The steps to be followed:-
1/
genarate pub-priv key pair by using ssh-keygen command
#home/abulhasi $ ssh-keygen
Generating public/private rsa key pair.
Please be patient.... Key generation may take a few minutes
Enter file in which to save the key (/home/abulhasi/.ssh/id_rsa): HASIM_TEST
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in HASIM_TEST.
Your public key has been saved in HASIM_TEST.pub.
The key fingerprint is:
bd:43:bc:68:01:ee:c5:7e:fa:b7:5d:ef:a0:6f:ee:00 abulhasi@
#home/abulhasi $ ls -lart
total 42
-r-------- 1 abulhasi users 334 Jul 26 01:57 .login
-r-------- 1 abulhasi users 832 Jul 26 01:57 .cshrc
-r-------- 1 abulhasi users 347 Jul 26 01:57 .exrc
-r-------- 1 abulhasi users 446 Jul 26 01:57 .profile
drwxr-xr-x 324 root root 12288 Sep 23 09:50 ..
-rw------- 1 abulhasi users 0 Sep 27 14:59 .lastlogin
-rw------- 1 abulhasi users 1743 Sep 27 15:03 HASIM_TEST
drwxr-xr-x 2 abulhasi users 1024 Sep 27 15:03 .
-rw------- 1 abulhasi users 397 Sep 27 15:03 HASIM_TEST.pub
-rw------- 1 abulhasi users 354 Sep 27 15:04 .sh_history
#home/abulhasi $ pwd
A Private key looks like:-
#home/abulhasi $ cat HASIM_TEST
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,AB70B38F52800F59
aYUzVMyTp65/p824PMrFhGZ2IBWjRlJ+QnLeHCSW3qFJV/dg2LhYCSsBxOq6HNwf
+QAxgi/W5z299pgiy9EZtkI08gFVlOHtQaRbU//0I3Ifnn9zC8ncoY8OfTeDf1gJ
fH1VB3R2c+m/03GdsQ2Xsm00d+LnyGwCW1HQoFx+BWXBiC6p1avXtZwwEn+77oWu
BzOn4hrfebKZnt4k08Ej4ZuJ5mZqzQ820+1pF61aOEs8rZXt2HwlUP9KtPVWaP3i
iRHSctQuL3OSulpEpG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cqCVy6QM6
a00kxx+cL8W7qRHe5jg8Ph9tNhBpA28pK8ycXevF/hmWBSdFHL9Ib/aX5w+rp8nh
CrP/NNChp5ZweoguNhRyULeZh0nVcMl0AZ+eyciIQLVxv0ZkUB99YeR/CD7xTL0z
GPFhxLeDYHP6DfwI4DlR0cDOsSnsp5vBtcyBVWtn0EJire+w8R4XgoZPC5sZaVWu
fpXc39+PTd2H5qcxxpCmconM+Y6kkiKhblsyar6rXKUcN55JZ4fxmQ==
-----END RSA PRIVATE KEY-----
A Public key looks like:-
#home/abulhasi $ cat HASIM_TEST.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1e+ftxpvHlDXdx/QccRkKAjukmLw6cNIQ0hiEWhUA3gCrYk7HdZdsT+Ag2mQpNoUZOV176R9b5FCpPvDjYX/7bL/Pflu23GsGTdDq78XyjCq9KJ/bboHRJxU8LJtuU3fRw9OashGLSfDLb6fTj22FnysyeD5sar24b3GGfrgistusqC2+DP99rtvrE8M046fc15H9KZ3TA8jHGZxJejcbj64lxjN9pKjRGUvxC8A42lVPe/ofBGP6kuP8xMau+rMXxB4FNVZchEwCXPTFls03ECdhnLrZ15EbD/E3AkqW5MiK/3JiQPGhAWXmItSiAPtspO7t0hQkaSbdyZXm6+0QQ== abulhasi@
2/
Send yours public key (HASIM_TEST.pub) to the remote server which is accepting ssh connection only.You can send them the key as a zipped file or by just copying and paste.
That remote server will add your publc key in the file ~/.ssh/authorized_keys.
3/
Once they have appended you can check it whether you can connect them or not by ssh -v remote_user@remote_machine
It may ask you for the passphrase whcih you have supplied at time of priv-pub key pair generation.
To get rid of entering passphrase you can add yours key in id_rsa by using ssh-agent :-
#home/abulhasi $ ssh-add id_dsa
Enter passphrase for id_dsa:
Identity added: id_dsa (id_dsa)
For more info check this page http://www.snailbook.com/faq/no-passphrase.auto.html
---: I am not responsible for any damages happened from the suggestion of my blog :---
Reach me at : m.a.hasim@inbox.com
Labels: Technical_HowTo_Unix