Why do you need password-less ssh ?
You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script
Is it Secure?
Yes. As long as you do not share your keys files
What are keys?
Keys are encrypted authentication files which automatically get checked when you login from one machine to another.
There are two major key types
What do I need ?
at least one linux machine
OPENSSH installed
one user with ssh permissions
How do I Do it?
You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script
Is it Secure?
Yes. As long as you do not share your keys files
What are keys?
Keys are encrypted authentication files which automatically get checked when you login from one machine to another.
There are two major key types
- RSA : RSA is an algorithm for public-key cryptography that is based on the presumed difficulty of factoring large integers, the factoring problem (From wikipedia)
- DSA : based on The Elliptic Curve Digital Signature Algorithm
Which one to choose?
Choice is yours.
DSA keys provide smaller keys and faster operations so I choose dsa most of the times. Please note this may not work with older OPENSSH versions
What do I need ?
at least one linux machine
OPENSSH installed
one user with ssh permissions
How do I Do it?
- if want then create a separate user . I will create user named test
- useradd test
- login to users shell : sudo su - test
- create .ssh directory default location. You can store the keys anywhere you need but then you will need lot of other configurations. So lets go with default
- mkdir -p ~/.ssh
- create the key
- command which creates keys is ssh-keygen. First decide which type and then run
- ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
- Above command will create two files in directory ~/.ssh. One is your private key file and other is public key file. change permission of both files to read only by user
- chmod 400 ~/.ssh/id_dsa*
- copy the contents of the .pub file into another machine or same machine's .ssh/authorized_keys
- Change permission for RW user only. chmod +600 .ssh/authorized_keys
- now you can ssh from first machine to second machine without inputing your password
No comments:
Post a Comment