본문 바로가기
IT/개발

[Windows] Powershell로 원격접속 및 파일전송하기(SFTP)

서버 관리 중 Windows PC에서 주로 Putty를 사용하여 리눅스 서버를 관리한다.

Putty

서버 IP, SSH Port 등을 Putty에 저장하여 바로 불러올수 있고 창크기 조절도 자유로워 사용하기 편하다.

하지만, Putty 같은 프로그램이 설치되지 않은 PC에서 작업할 경우 윈도우에서 지원하는 SFTP로

리눅스에 접속하여 작업 및 파일 송수신이 가능하다.

 

SFTP는 Secure FTP의 약자로 평문으로 파일이 전달되는 FTP의 문제를 보완한 프로토콜이다.

SFTP는 SSH 방식을 이용하여 암호화된 구간에서 FTP기능을 사용하며, 전송되는 파일의 내용은

암호화되어 전송된다

사용포트 22

 

PowerShell을 이용한 SFTP 파일 전송 방법

윈도우 디렉토리에서 Shift + 우클릭을 하면, [여기에 PowerShell 창 열기] 컨텍스트 메뉴가 추가되어 나온다.

 

해당 화면처럼 PowerShell에서 

sftp 사용자계정@서버IP를 입력하여 서버에 접속한다.

 

#PowerShell

#SFTP 접속
C:\User\Dektop> sftp root@1.1.1.1

#명령어 확인
sftp> ?

#현재디렉토리 확인
sftp> lpwd #local 
sftp> pwd #remote 

#ls
sftp> lls #local
sftp> ls #remote

#cd
sftp> lcd #local
sftp> cd #remote

#put 파일업로드
sftp> put filename.확장자 #local -> remote
sftp> mput *.확장자 #local -> remote 여러파일[멀티]

#get 파일다운로드
sftp> get filename.확장자 #remote -> local
sftp> mget filename.확장자 #remote -> local 여러파일[멀티]

#rm 삭제
sftp> rm filename.확장자 #remote
sftp> rmdir directoryname #remote

▶ 원격 서버 관리 프로그램 다운로드 주소

PuTTY : https://www.putty.org/

 

Download PuTTY - a free SSH and telnet client for Windows

Is Bitvise affiliated with PuTTY? Bitvise is not affiliated with PuTTY. We develop our SSH Server for Windows, which is compatible with PuTTY. Many PuTTY users are therefore our users as well. From time to time, they need to find the PuTTY download link. W

www.putty.org

WinSCP : https://winscp.net/eng/download.php

 

WinSCP :: Official Site :: Download

WinSCP 5.19 Download WinSCP 5.19 is a major application update. New features and enhancements include: A complete list of files that are part of a background transfer can be shown. Support for PPK version 3 keys from PuTTY 0.75. Stream interface in .NET as

winscp.net

FileZila : https://filezilla-project.org/

 

FileZilla - The free FTP solution

Overview Welcome to the homepage of FileZilla®, the free FTP solution. The FileZilla Client not only supports FTP, but also FTP over TLS (FTPS) and SFTP. It is open source software distributed free of charge under the terms of the GNU General Public Licen

 

PowerShell을 사용하는 경우는 상기 프로그램이 없을경우에만 사용하고 그외는 관리도구를 이용하는게 편리하다.