-------- CREATE .ssh DIRECTORY ON LOCAL MACHINE --------
hostname # cd /root
hostname # mkdir .ssh
hostname # chmod 700 .ssh
-------- GENERATE PRIVATE-KEY/PUBLIC-KEY PAIR ON LOCAL --------
hostname # ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): <-- RETURN
Enter passphrase (empty for no passphrase): <-- PASSPHRASE
Enter same passphrase again: <-- PASSPHRASE
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
A1:A2:A3:A4:A5:A1:A2:A3:A4:A5:A1:A2:A3:A4:A5: user@hostname.customer.com
Hostname # ls -l .ssh
total 12
-rw------- 1 root root 951 Jan 29 09:18 id_rsa <- PRIVATE KEY - LOCAL
-rw-r--r-- 1 root root 237 Jan 29 09:18 id_rsa.pub <-- PUBLIC KEY - REMOTE
hostname # cat .ssh/id_rsa.pub
ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= user@hostname.customer.com
-------- COPY PUBLIC KEY TO REMOTE USING PASSWORD --------
hostname # scp -p .ssh/id_rsa.pub 192.168.xxx.xxx:/root/
root@192.168.xxx.xxx's password: <-- PASSWORD ON REMOTE MACHINE
id_rsa.pub 100% 237 0.2KB/s 00:00
-------- SSH TO REMOTE USING PASSWORD --------
hostname # ssh 192.168.xxx.xxx
The authenticity of host '192.168.xxx.xxx (192.168.xxx.xxx)' can't be established.
RSA key fingerprint is A1:A2:A3:A4:A5:A1:A2:A3:A4:A5:A1:A2:A3:A4:A5.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.xxx.xxx' (RSA) to the list of known hosts.
root@192.168.xxx.xxx's password: <-- PASSWORD ON REMOTE MACHINE - LAST TIME
Last login: Thu Jan 29 10:19:54 2009
------ INSTALL LOCAL'S PUBLIC-KEY ON REMOTE AS AUTHORIZED ------
remote-host # ls -l
total 4
-rw-r--r-- 1 root root 247 Jan 29 10:18 id_rsa.pub
remote-host # ls -ld .ssh
ls: .ssh: No such file or directory
remote-host # mkdir .ssh
remote-host # chmod 700 .ssh
remote-host # touch .ssh/authorized_keys
remote-host # cat id_rsa.pub >> .ssh/authorized_keys
remote-host # cat .ssh/authorized_keys
ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= user@hostname.customer.com
remote-host # ls -al .ssh
total 12
drwx------ 2 root root 4096 Jan 29 10:35 .
drwx------ 3 root root 4096 Jan 29 10:33 ..
-rw-r--r-- 1 root root 237 Jan 29 10:35 authorized_keys
-------- BACK TO LOCAL --------
remote-host # exit
Connection to 192.168.xxx.xxx closed.
-------- CONNECT TO REMOTE USING PRIVATE-KEY/PUBLIC-KEY --------
hostname # ssh 192.168.xxx.xxx
Enter passphrase for key '/root/.ssh/id_rsa': <-- PASSPHRASE FOR THIS KEY
Last login: Thu Jan 29 10:34:17 2009 from 192.168.xxx.xxx
------ CONNECTED TO REMOTE USING PRIVATE-KEY/PUBLIC-KEY ------
Saturday, February 21, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment