Ssh

From 탱이의 잡동사니
Revision as of 08:53, 3 December 2018 by Pchero (talk | contribs)
Jump to navigation Jump to search

Overview

ssh 내용 정리.

Create key

ssh 를 사용하기 위해서는 ssh key 가 필요하다. 다음의 명령어로 간단하게 키 생성이 가능하다.

[stk@pchero21.com ~]$ ssh-keygen 

Generating public/private rsa key pair.
Enter file in which to save the key (/home/stk/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/stk/.ssh/id_rsa.
Your public key has been saved in /home/stk/.ssh/id_rsa.pub.
The key fingerprint is:
1c:fb:fa:f1:f7:f4:13:62:79:8e:57:45:b8:52:cb:a0 stk@pchero21.com
The key's randomart image is:
+--[ RSA 2048]----+
|             oo  |
|         .. o.   |
|        =.o+.o   |
|       o.X.o+    |
|        S X.     |
|         * +     |
|        . o      |
|         .       |
|                 |
+-----------------+

키 생성 이후, ~/.ssh 디렉토리를 확인하면 생성된 key 내용들을 볼 수 있다.

$ cd ~/.ssh

$ ls -tlr
total 16
-rw-------. 1 stk stk  397 Oct 29  2015 authorized_keys
-rw-r--r--. 1 stk stk  668 May 11 10:27 known_hosts
-rw-r--r--. 1 stk stk  416 May 11 11:01 id_rsa.pub
-rw-------. 1 stk stk 1675 May 11 11:01 id_rsa

-L

Local port forwarding using ssh.

     -L [bind_address:]port:host:hostport
     -L [bind_address:]port:remote_socket
     -L local_socket:host:hostport
     -L local_socket:remote_socket

Example

$ ssh -L 127.0.0.1:80:intra.example.com:80 gw.example.com

See also

References

<references />