Saturday, May 28, 2011

remote SSH without type password everytime

SSH is a service use to remote to other machine in Linux or Mac in Terminal.
Here is the way that I Did with SSH to remote without type USERNAME and PASSWORD every time that I conncet or remote to other server.
Instead by using Key:


-----How TO---


#Go to ".ssh" folder On Ur computer and Generate the key  by:  
Open a terminal and type

cd .ssh

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 id_rsa.pub to Ur Server in folder ".ssh" By:

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

Type ur root password when it ask..!!

# On Ur Server go to ".ssh" folder and generate the key

root@ur-server:~/.ssh$ ssh-keygen -b 1024 -t rsa

#On ur server Create a file name "authorized_keys" in ".ssh" folder

#Go to folder ".ssh" in Ur Server

root@ur-server:~/.ssh$ cat vannak.pub >> authorized_keys

#Access with the ShortCut Name:  EX: "myserver.com.kh" to "server"

    Host server
  HostName myserver.com.kh
  User root
  IdentityFile /home/vannak/.ssh/id_rsa

So Next time U just TYPE:  "  ssh server " it log in automatically to ur server.

-------------That Done---U can SSH to Ur Server Without prompt for password Everytime From ur computer...!!------------

No comments:

Post a Comment