To login from one linux box to another without having to type the password, follow the below steps. This is useful when you have to install or setup some software on the 2nd linux box using a automated tool. Just follow the lines in blue. The other lines are generated by the commands.
[devu@vmhostname01 ~]$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (default file name /home/devu/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/devu/.ssh/id_rsa. Your public key has been saved in /home/devu/.ssh/id_rsa.pub. The key fingerprint is: 2f:bb:6c:e5:9b:90:44:f5:37:34:f8:7c:78:6f:39:96 devu@vmhostname01 The key's randomart image is: +--[ RSA 2048]----+ | . .o | | . ... . | | . .oo. | | . .+.o| | S o+| | . o. Eo| | +o. ...| | ..+.. | | .+.o. | +-----------------+ [devu@vmhostname01 ~]$ ls -ltr .ssh/ total 20 -rw-r-----. 1 devu devu 405 Dec 18 2013 authorized_keys -rw-r--r--. 1 devu devu 4189 Aug 19 04:15 known_hosts -rw-------. 1 devu devu 1675 Aug 20 21:19 id_rsa -rw-r--r--. 1 devu devu 401 Aug 20 21:19 id_rsa.pub [devu@vmhostname01 ~]$ cd .ssh/ [devu@vmhostname01 .ssh]$ ssh-copy-id -i id_rsa.pub devu@vmhostname02 ***WARNING***devu@vmhostname02's password: Now try logging into the machine, with "ssh 'devu@vmhostname02'", and check in : .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. [devu@vmhostname01 .ssh]$ ssh devu@vmhostname02 [devu@vmhostname02 ~]$
No comments:
Post a Comment