Editing
How to do a SSH authentication without password
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
go back to [[Main Page]], [[Computational Resources]], [[Information & Help]], [[Chemistry & More]], [[Linux & Unix]] '''Introduction''' Each time you want to connect to an external server you need your password... You're tired? I propose a method to avoid having to enter password. To do this we will use the '''SSH key''' with DSA encryption ( it exist also and RSA encryption, the choice is completely arbitrary) Principle is simple: *You create an encrypted SSH key for your user (user_local) on the local computer (local) *You send a public part of it to your user (user_server) on the distant server (for example kimik2) '''Create a SSH encrypted key on the local machine''' The key is composed of two file: id_dsa and id_dsa.pub. *id_dsa is the '''private''' key!!! '''DO NOT DIVULGE !!!''' *id_dsa.pub is the public key. First, check if you have or not this key. It is located in the .ssh directory /home/user_local/.ssh/ If there is already this two file, go to the last part of this tutorial, else let's create this files. It is very easy via the keygen function: ssh-keygen -t dsa The computer ask you: Enter file in which to save the key (/home/user_local/.ssh/id_dsa): Enter passphrase (empty for no passphrase): I let the first empty to have the default name. Then the computer ask you for a '''passphrase'''. Of course '''you have to put one''' for your security (I don't put passphrase). This passphrase will be ask at each new local session. If everything is OK, the 'echo' is: Your identification has been saved in /home/user_local/.ssh/id_dsa. Your public key has been saved in /home/user_local/.ssh/id_dsa.pub. The key fingerprint is: 7b:53:c3:.................:e8:6c:bb user@local The key's randomart image is: +--[ DSA 1024]----+ | | | | | | | . . | | S ++.o | | . +o+++ | | . +oo +=.| | .E+...| +-----------------+ Bravo, you create an SSH encrypted key. '''Installing SSH public key on the server''' There are 2 methods. The first is automatic and easy (but not present in all the distributions), the second is manual and easy too. As I'm lazy, I will describe only the automatic. If that doesn't work, go on the web. *Automated method: In your openssh utilities, we are using the ''ssh-copy-id''. This command will automatically add your public key (''id_dsa.pub'') of the local computer in the file ''~/.ssh/authorized_keys'' on the distant server. In your local computer, type the command: ssh-copy-id user_server@server After entering your password and your passphrase for the last time, the public key is copied to the user account "user_server" server. '''''try and feel free to modify this tutorial''''' In my case, dsa type (ssh-keygen -t dsa) does not work, rsa (default type) works. So maybe try following commands if you meet problems. ssh-keygen ssh-copy-id -i user_server@server ssh user_server@server http://www.openssh.com/ [[Image:Logo_openssh.png]] http://en.wikipedia.org/wiki/Ssh-keygen http://linux.die.net/man/1/ssh-copy-id
Summary:
Please note that all contributions to Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information