Saturday, April 20, 2013

Auto Log in without password with SSH


Client Linux...!

#Go to ".ssh" folder On Ur computer and Generate the key
vannak@computer:~/.ssh$ ssh-keygen -b 1024 -t rsa -C vannak@mail.com

Note: Just Enter When the machine Ask..!!

Then u will have : id_rsa  id_rsa.pub  known_hosts

#Copy file id_rsa.pub to the the Server put in folder ".ssh" and rename to file authorized_key By:

vannak@computer:~/.ssh$ scp id_rsa.pub root@ur-server:.ssh/authorized_key

Type ur root password when it ask..!!

#Access with the ShortCut Name:  EX: "myserver.com.kh" to "server"
#vannak@computer:~/.ssh$sudo touch config
Add the following content

    Host server
  HostName myserver.com.kh
  User root
  Port 2200
  IdentityFile /home/vannak/.ssh/id_rsa
 -----------------------------------------------------------------------------------------------------------------
Client Windows...!
1. Generare Key on Windows Clients using puttygen (We will Have Public and Private Key)
Put your phaseprase and Save Public and Private Key
-Remove the first line and last line and replace the second line to 'ssh-rsa'
-And then remove all indention like follows. 'ssh-rsa

2. Go to your Server
- Create a folder name ".ssh" <>
- Create a file name "authorized_keys" in folder ".ssh"
- Copy All generate in "PublicKey" and paste to file "authorized_keys"

3. Go to your Window Client with Putty
- on Auth --> Browse to your "PrivateKey"

Note: You Always broswe to "PrivateKey" for each access.
It also Easy for YOU When We access to many DIFFENT SERVERS using Differnt KEYS....! ;)

No comments:

Post a Comment