티스토리 뷰

예제)

  - A(123.111.111.111) 에서 B(123.111.111.112)로 ssh접속 및 명령어 전송

  - B에는 test계정으로 접속




A에서 키생성

[boya@A ~]$ ssh-keygen 

Generating public/private rsa key pair. 

Enter file in which to save the key (/home/boya/.ssh/id_rsa): 

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

Your identification has been saved in /home/boya/.ssh/id_rsa. 

Your public key has been saved in /home/boya/.ssh/id_rsa.pub. 

The key fingerprint is: 

20:41:a9:71:6d:c6:bf:1b:11:52:23:12:46:51:68:40 boya@A

The key's randomart image is: 

+--[ RSA 2048]----+ 

|oE=o.  .o.       | 

| oo.   ..  .     | 

| .  . ..+oo      | 

|     ...o*=      | 

|       oSo..     | 

|           ..    | 

|          .  .   | 

|           ..    | 

|          ..     | 

+-----------------+         



A에서 생성한 키를 B에 복사

[boya@A ~]$ ssh-copy-id test@123.111.111.112

test@123.111.111.112's password: 

Now try logging into the machine, with "ssh 'test@123.111.111.112'", and check in: 

 

  .ssh/authorized_keys 

 

to make sure we haven't added extra keys that you weren't expecting. 



A에서 B에 접속

ssh test@123.111.111.112



A에서 B에 명령어 전송(ls -alst)

ssh test@123.111.111.112 ls -alst


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함