ssh를 이용하여 파일을 전송할 수 있는 방법을 소개한다.

 

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch17_:_Secure_Remote_Logins_and_File_Copying

 

SCP: A Secure Alternative to FTP

From a networking perspective, FTP isn't very secure, because usernames, passwords, and data are sent across the network unencrypted. More secure forms such as SFTP (Secure FTP) and SCP (Secure Copy) are available as a part of the OpenSSH package that is normally installed by default on RedHat and Fedora Core. Remember, unlike FTP, SCP doesn't support anonymous downloads like FTP.

The Linux scp command for copying files has a format similar to that of the regular Linux cp command. The first argument is the source file and the second is the destination file. When copying to or from a remote server, SCP logs in to the server to transfer the data and this therefore requires you to supply a remote server name, username, and password to successfully execute the command. The remote filename is therefore preceded by a prefix of the remote username and server name separated by an @ symbol. The remote filename or directory then follows separated by a colon. The format therefore looks like this:

username@servername:filenameusername@servername:directoryname

For example, file /etc/syslog.conf on a server with IP address 192.168.1.100 that needs to be retrieved as user peter would have the format peter@192.168.1.000:/etc/syslog.conf, the entire /etc directory would be peter@192.168.1.000:/etc/.

Note: You can download an easy-to-use Windows SCP client called WinSCP from http://winscp.vse.cz/eng/

Copying Files To The Local Linux Box

If you understand how scp represents remote filenames, you can start copying files fairly easily. For example, to copy file /tmp/software.rpm on the remote machine to the local directory /usr/rpm use the commands

[root@bigboy tmp]# scp root@smallfry:/tmp/software.rpm /usr/rpmroot@smallfry's password:software.rpm                      100% 1011    27.6KB/s   00:00[root@bigboy tmp]#

To copy the file /tmp/software.rpm on the remote machine to the local directory /usr/rpm using TCP port 435, use the commands

[root@bigboy tmp]# scp -P 435 root@smallfry:/tmp/software.rpm /usr/rpmroot@smallfry's password:software.rpm                       100% 1011    27.6KB/s   00:00[root@bigboy tmp]#
 
 
Posted by '김용환'

댓글을 달아 주세요