BE/Linux
리눅스 원격 서버 파일 송수신
tired_i
2022. 5. 6. 23:32
출처 : https://daebaq27.tistory.com/73
출처 : https://eehoeskrap.tistory.com/543
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>
# 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>
SFTP
SFTP : Secure File transfer protocol
# upload
sftp -P <port_num> <username>@<ip>
put <filename_to_upload>
put -r <directory_to_upload>
# download
sftp -P <port_num> <username>@<ip>
get <filename_to_download>
get -r <directory_to_download>
# 로컬 혹은 서버에 저장될 디렉터리 설정
lcd <target_directory>
# close sftp
bye
sftp로 연결된 상태에서 cd, pwd, ls -al 등 일부 명령어도 사용할 수 있다.