리눅스 원격 서버 파일 송수신

 

출처 : https://daebaq27.tistory.com/73

출처 : https://eehoeskrap.tistory.com/543


Contents

SCP

SCP : SeCure coPy.

ssh를 이용하여 네트워크로 연결된 호스트 간에 파일을 주고받는 명령어

# up
# local to server upload file
scp -P <port 번호> <local file path> <username>@<ip>:<path>

# local to server upload directory
scp -r -P <port 번호> <local file path> <username>@<ip>:<path>
Code language: HTML, XML (xml)
# down
# server to local download file
scp -P <port 번호> <username>@<ip>:<path> <local file path>

# server to local download directory
scp -r -P <port 번호> <username>@<ip>:<path> <local file path>
Code language: HTML, XML (xml)

SFTP

SFTP : Secure File transfer protocol

# upload
sftp -P <port_num> <username>@<ip>
put <filename_to_upload>
put -r <directory_to_upload>
Code language: HTML, XML (xml)
# download
sftp -P <port_num> <username>@<ip>
get <filename_to_download>
get -r <directory_to_download>
Code language: HTML, XML (xml)
# 로컬 혹은 서버에 저장될 디렉터리 설정
lcd <target_directory>
Code language: HTML, XML (xml)
# close sftp
bye
Code language: PHP (php)

sftp로 연결된 상태에서 cd, pwd, ls -al 등 일부 명령어도 사용할 수 있다.


댓글 남기기