ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • IBM AIX SCP, FTP 사용 방법
    System of Infra/Unix System 2020. 4. 20. 20:29
    반응형

    AIX로고이미지

    IBM AIX SCP, FTP 사용 방법

    [root@test_svr1:/]# ifconfig -a
    
    en3: flags=1e084863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
    inet 10.50.1.206 netmask 0xffffff00 broadcast 10.50.1.255
    tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
    
    [root@test_svr2:/]# ifconfig -a
    en3: flags=1e084863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
    inet 10.50.1.207 netmask 0xffffff00 broadcast 10.50.1.255
    tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1

    -> test_svr1 서버는 10.50.1.206 대역을 사용하고 test_svr2 서버는 10.50.1.207 대역을 사용합니다.

    [root@test_svr1:/tmp/pinetree]# touch file_test1;touch file_test2;touch file_test3

    -> 테스트를 위해서 임시로 test_svr의 /tmp/pinetree경로에 touch파일로 file_test 1,2,3을 생성합니다.

    [root@test_svr1:/tmp/pinetree]# chmod 777 file_test1;chmod 777 file_test2;chmod 777 file_test3

    -> 만찬가지로 권한까지 가져오는 방식을 테스트를 위해서 권한을 777로 모두 변경해 줍니다.

    [root@test_svr1:/tmp/pinetree]# ls -al
    total 8
    drwxr-xr-x    2 root    system          256 Apr 20 15:13 .
    drwxrwxrwt  22 bin      bin            4096 Apr 20 15:15 ..
    -rwxrwxrwx    1 root    system            0 Apr 20 15:10 file_test1
    -rwxrwxrwx    1 root    system            0 Apr 20 15:11 file_test2
    -rwxrwxrwx    1 root    system            0 Apr 20 15:12 file_test3

    -> file_test1,2,3가 생성된 것을 확인할 수 있습니다.

    [root@test_svr1:/tmp/pinetree]# scp  /tmp/pinetree/file_test* root@10.50.1.207:/tmp/pinetree/
    root@10.50.1.207's password:
    file_test1                                                                      100%    0    0.0KB/s  00:00   
    file_test2                                                                      100%    0    0.0KB/s  00:00   
    file_test3                                                                      100%    0    0.0KB/s  00:00\

    -> 현재의 경로에서 test_file1,2,3을 10.50.1.207의 대역인 test_svr2 서버의 /tmp/pinetree/ 경로에 권한을 부여하지 않은 상태로 scp전송을 합니다.

    [root@test_svr2:/tmp/pinetree]# ls -al
    total 8
    drwxr-xr-x    2 root    system          256 Apr 20 15:21 .
    drwxrwxrwt  19 bin      bin            4096 Apr 20 15:20 ..
    -rwxr-xr-x    1 root    system            0 Apr 20 15:21 file_test1
    -rwxr-xr-x    1 root    system            0 Apr 20 15:21 file_test2
    -rwxr-xr-x    1 root    system            0 Apr 20 15:21 file_test3

    -> test_svr2에서 전송된 경로에서 ls -al의 명령어를 통해서 파일들이 있는 것을 확인할 수 있습니다. 하지만 test_svr1서버에 있는 파일들의 권한을 똑같이 가져오지 못하는 것을 확인할 수 있습니다.

    [root@test_svr2:/tmp/pinetree]# rm file_test*

    -> test_svr2에서 다시한번 테스를 하기 위해서 파일들을 삭제해보도록 하겠습니다.

    [root@test_svr1:/tmp/pinetree]# scp -p /tmp/pinetree/file_test* root@10.50.1.207:/tmp/pinetree/
    root@10.50.1.207's password:
    file_test1                                                                      100%    0    0.0KB/s  00:00   
    file_test2                                                                      100%    0    0.0KB/s  00:00   
    file_test3                                                                      100%    0    0.0KB/s  00:00

    -> scp -p의 옵션을 통해서 파일들의 권한까지 전송을 할 수 있도록 하여 scp전송을 하였습니다.

    [root@test_svr2:/tmp/pinetree]# ls -al
    total 8
    drwxr-xr-x    2 root    system          256 Apr 20 15:22 .
    drwxrwxrwt  19 bin      bin            4096 Apr 20 15:20 ..
    -rwxrwxrwx    1 root    system            0 Apr 20 15:10 file_test1
    -rwxrwxrwx    1 root    system            0 Apr 20 15:11 file_test2
    -rwxrwxrwx    1 root    system            0 Apr 20 15:12 file_test3

    -> 기존의 권한을 못가져온거와 달리 이번에는 권한까지 모두 가져와 전송이 되었습니다.

    [root@test_svr1:/tmp/pinetree]# rm file_test*

    -> 기존에는 test_svr1에서 test_svr2에 파일을 전송해줬다고 한다면 이번에는 반대로 svr_test2번에서 scp로 파일을 가져오도록 해보겠습니다. 그러기 위해서 test_svr1의 파일들을 삭제하도록 하겠습니다.

    [root@test_svr1:/tmp/pinetree]# ls -al
    total 8
    drwxr-xr-x    2 root    system          256 Apr 20 15:23 .
    drwxrwxrwt  22 bin      bin            4096 Apr 20 15:30 ..

    -> test_svr1의 해당경로에 파일들이 삭제되었습니다.

    [root@test_svr1:/tmp/pinetree]# scp -p root@10.50.1.207:/tmp/pinetree/file* /tmp/pinetree/
    root@10.50.1.207's password:
    file_test1                                                                      100%    0    0.0KB/s  00:00   
    file_test2                                                                      100%    0    0.0KB/s  00:00   
    file_test3                                                                      100%    0    0.0KB/s  00:00

    -> 해당 파일들을 받아오도록 합니다.

    [root@test_svr1:/tmp/pinetree]# ls -al
    total 8
    drwxr-xr-x    2 root    system          256 Apr 20 15:37 .
    drwxrwxrwt  22 bin      bin            4096 Apr 20 15:35 ..
    -rwxrwxrwx    1 root    system            0 Apr 20 15:10 file_test1
    -rwxrwxrwx    1 root    system            0 Apr 20 15:11 file_test2
    -rwxrwxrwx    1 root    system            0 Apr 20 15:12 file_test3

    -> ls -al의 명령어에서 파일들은 없었지만 test_svr2에서 파일들을 받아오면서 생성되었습니다. 이것으로 SCP로 전송을 했을 때 가져오기 전송하기 두 가지 방식을 테스트하였습니다.

    [root@test_svr2:/tmp/pinetree]# ls -al
    total 16
    drwxr-xr-x 2 root system 256 Apr 20 19:08 .
    drwxrwxrwt 19 bin bin 4096 Apr 20 19:08 ..
    -rwxrwxrwx 1 root system 0 Apr 20 18:57 file_test1
    -rwxrwxrwx 1 root system 0 Apr 20 18:57 file_test2
    -rwxrwxrwx 1 root system 0 Apr 20 18:57 file_test3
    -rw-r--r-- 1 root system 10 Apr 20 19:08 ftp_file1

    -> test_svr2에서 ftp_file1이라는 파일을 생성하였고 이 파일을 test_svr1에서 ftp로 가져오도록 하겠습니다.

    [root@test_svr1:/tmp/pinetree]# ftp 10.50.1.207
    Connected to 10.50.1.207.
    220 test_svr2 FTP server (Version 4.2 Tue Nov 14 17:16:56 CST 2017) ready.
    Name (10.50.1.207:root): root
    331 Password required for root.
    
    Password:
    230-Last unsuccessful login: Mon Apr 20 18:56:47 KST 2020 on ssh from test_svr1
    230-Last login: Mon Apr 20 18:57:00 KST 2020 on ssh from test_svr1
    
    230 User root logged in.
    ftp> pwd
    257 "/" is current directory.
    
    ftp> cd tmp
    250 CWD command successful.
    
    ftp> cd pinetree
    250 CWD command successful.
    
    ftp> pwd
    257 "/tmp/pinetree" is current directory.

    ->test_svr2서버에 FTP IP 접속을 하였습니다.

    ftp> get ftp_file1
    200 PORT command successful.
    150 Opening data connection for ftp_file1 (10 bytes).
    226 Transfer complete.
    11 bytes received in 7.2e-05 seconds (149.2 Kbytes/s)
    local: ftp_file1 remote: ftp_file1
    
    ftp> bye
    221 Goodbye.

    -> ftp_file1이라는 파일을 /tmp/pintree/의 해당 경로에 가져오기를 하였습니다.

    [root@test_svr1:/tmp/pinetree]# ls -al
    total 16
    drwxr-xr-x 2 root system 256 Apr 20 19:10 .
    drwxrwxrwt 22 bin bin 4096 Apr 20 19:10 ..
    -rw-r--r-- 1 root system 10 Apr 20 19:10 ftp_file1

    -> 해당 경로에 파일 가져오기가 된 것을 확인할 수 있습니다.

    [root@test_svr1:/tmp/pinetree]# ls -al
    total 24
    drwxr-xr-x 2 root system 256 Apr 20 19:12 .
    drwxrwxrwt 22 bin bin 4096 Apr 20 19:10 ..
    -rw-r--r-- 1 root system 10 Apr 20 19:10 ftp_file1
    -rw-r--r-- 1 root system 10 Apr 20 19:12 ftp_file2

    -> 이번엔 반대로 test_svr1에 ftp_file2라는 파일을 한 개 생성한 뒤 ftp를 통해서 test_svr2에 전송을 해주도록 하겠습니다.

    [root@test_svr1:/tmp/pinetree]# ftp 10.50.1.207
    Connected to 10.50.1.207.
    220 test_svr2 FTP server (Version 4.2 Tue Nov 14 17:16:56 CST 2017) ready.
    Name (10.50.1.207:root): root
    331 Password required for root.
    
    Password:
    230-Last unsuccessful login: Mon Apr 20 18:56:47 KST 2020 on ssh from test_svr1
    230-Last login: Mon Apr 20 19:10:14 KST 2020 on ftp from test_svr1
    230 User root logged in.
    
    ftp> cd tmp
    250 CWD command successful.
    
    ftp> cd pinetree
    250 CWD command successful.
    
    ftp> put ftp_file2
    200 PORT command successful.
    150 Opening data connection for ftp_file2.
    226 Transfer complete.
    11 bytes sent in 0.000171 seconds (62.82 Kbytes/s)
    local: ftp_file2 remote: ftp_file2

    ->ftp_file2의 파일을 test_svr2에 전송하도록 하겠습니다.

    [root@test_svr2:/tmp/pinetree]# ls -al
    total 24
    drwxr-xr-x 2 root system 256 Apr 20 19:18 .
    drwxrwxrwt 19 bin bin 4096 Apr 20 19:18 ..
    -rwxrwxrwx 1 root system 0 Apr 20 18:57 file_test1
    -rwxrwxrwx 1 root system 0 Apr 20 18:57 file_test2
    -rwxrwxrwx 1 root system 0 Apr 20 18:57 file_test3
    -rw-r--r-- 1 root system 10 Apr 20 19:08 ftp_file1
    -rw-r----- 1 root system 10 Apr 20 19:18 ftp_file2

    ->test_svr2에 ftP_file2의 파일이 전송된 것을 확인할 수 있습니다.

     

     

    PS. 포스팅의 내용은 제 기준으로 작성한 것이기 때문에 참고해서 보시면 감사하겠습니다.

    포스팅 과정의 오류 및 오타 그리고 궁금한 점에 대해서는 댓글 남겨주세요.

    반응형

    댓글

Designed by Tistory.