Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

(시리즈 글이 8개 있습니다.)
개발 환경 구성: 371. Azure Web App 확장 예제 - Simple WebSite Extension
; https://www.sysnet.pe.kr/2/0/11505

개발 환경 구성: 379. Azure Web App 확장 예제 제작
; https://www.sysnet.pe.kr/2/0/11540

개발 환경 구성: 380. Azure Web App 확장 배포 방법
; https://www.sysnet.pe.kr/2/0/11541

개발 환경 구성: 408. C# - REST API를 이용해 Azure Kudu 서비스 이용 - 파일 처리
; https://www.sysnet.pe.kr/2/0/11730

개발 환경 구성: 409. C# - REST API를 이용해 Azure Kudu 서비스 이용 - 웹 앱 확장 처리
; https://www.sysnet.pe.kr/2/0/11731

개발 환경 구성: 578. Azure - Java Web App Service를 위한 Site Extension 제작 방법
; https://www.sysnet.pe.kr/2/0/12711

개발 환경 구성: 579. Azure - 리눅스 호스팅의 Site Extension 제작 방법
; https://www.sysnet.pe.kr/2/0/12712

개발 환경 구성: 605. Azure App Service - Kudu SSH 환경에서 FTP를 이용한 파일 전송
; https://www.sysnet.pe.kr/2/0/12855




Azure App Service - Kudu SSH 환경에서 FTP를 이용한 파일 전송

Azure App Service의 Kudu SSH 환경에서 ftp를 사용하려면 우선 클라이언트부터 설치해야 합니다.

# apt install ftp

참고로, SSH로 들어갈 때마다 매번 저렇게 설치를 해야 합니다. (해당 인스턴스 환경이 cache되는 동안만 유효한 듯!)

그다음 FTP 세션으로 들어가 연결을 하고 로그인까지 마칩니다.

# ftp
> open 100.10.5.1
220 Microsoft FTP Service
Name (100.10.5.1:root): testusr
331 Password required
Password:
230 User logged in.
Remote system type is Windows_NT.

이후 파일 전송을 하면 되는데 다음과 같은 식으로 오류가 발생할 수 있습니다.

ftp> put /home/site/wwwroot/logs/t1.log
local: /home/site/wwwroot/logs/t1.log remote: /home/site/wwwroot/logs/t1.log
501 Server cannot accept argument.
ftp: bind: Address already in use

ftp> put /home/site/wwwroot/logs/t1.log /t1.log
local: /home/site/wwwroot/logs/t1.log remote: /t1.log
501 Server cannot accept argument.

왜냐하면 기본적으로 Active 모드로 동작하기 때문입니다. 따라서 Passive 모드로 변경을 하고,

ftp> passive
Passive mode on.

다시 put 명령어로 파일 전송을 하면 됩니다.

ftp> put /home/site/wwwroot/logs/t1.log /t1.log
local: /home/site/wwwroot/logs/t1.log remote: /t1.log
227 Entering Passive Mode (100,10,5,1,191,115).
125 Data connection already open; Transfer starting.
226 Transfer complete.
19495005 bytes sent in 0.22 secs (86.4566 MB/s)

원하는 동작을 모두 완료했으면 quit 명령어로 세션을 나갑니다.

ftp> quit
221 Goodbye.




참고로, put 명령어에 파일의 full path를 적어주면 remote 측도 그렇게 경로 구성이 되어 있어야 합니다. 그렇지 않은 경우 다음과 같은 식으로 오류가 발생하는데요,

ftp> put /home/site/wwwroot/logs/t1.log
local: /home/site/wwwroot/logs/t1.log remote: /home/site/wwwroot/logs/t1.log
501 Server cannot accept argument.

이럴 때는 put 명령어의 2번째 인자에 원격 측의 경로를 함께 기입하면 됩니다.

ftp> put /home/site/wwwroot/logs/t1.log /t1.log
local: /home/site/wwwroot/logs/t1.log remote: /t1.log
227 Entering Passive Mode (100,10,5,1,191,115).
125 Data connection already open; Transfer starting.
226 Transfer complete.
19495005 bytes sent in 0.22 secs (86.4566 MB/s)




한 가지 주의할 점이 있는데요, Linux의 ftp도 기본적으로는 FTP over SSL 기능을 지원하지 않습니다. 따라서, 대상 FTP 서버에서 "over SSL" 기능을 풀어야 하는데요, 예를 들어 지난번의 글에 설정한 FTP 서비스라면,

Azure - 윈도우 VM에서 FTP 여는 방법
; https://www.sysnet.pe.kr/2/0/12854

IIS의 "FTP SSL Settings"를 통해 "Require SSL connections"로 지정된 기본값을 "Allow SSL connection"으로 낮춰야 합니다. 물론, 이렇게 하면 평문으로 암호가 전달되기 때문에 Azure App Service <-> Azure VM 간의 통신에는 그나마 안전할 수 있지만, 자칫 외부에서 접속을 한다거나 할 때 평문 암호 전달이 될 수 있으므로 심각한 보안 허점이 될 수 있습니다. 따라서 그런 경우에는 NSG의 설정을 통해,

Azure VM의 서비스를 Azure Web App Service에서만 접근하도록 NSG 설정을 제한하는 방법
; https://www.sysnet.pe.kr/2/0/12704

FTP 서비스 포트에 대해 Azure 내부에서만 통신을 허용하는 식으로 구성하는 것이 바람직합니다.




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 11/14/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 61  62  63  64  65  66  67  68  69  70  71  [72]  73  74  75  ...
NoWriterDateCnt.TitleFile(s)
12131정성태1/27/202020104개발 환경 구성: 467. LocaleEmulator를 이용해 유니코드를 지원하지 않는(한글이 깨지는) 프로그램을 실행하는 방법 [1]
12130정성태1/26/202017447VS.NET IDE: 142. Visual Studio에서 windbg의 "Open Executable..."처럼 EXE를 직접 열어 디버깅을 시작하는 방법
12129정성태1/26/202023498.NET Framework: 882. C# - 키움 Open API+ 사용 시 Registry 등록 없이 KHOpenAPI.ocx 사용하는 방법 [3]
12128정성태1/26/202017883오류 유형: 591. The code execution cannot proceed because mfc100.dll was not found. Reinstalling the program may fix this problem.
12127정성태1/25/202017110.NET Framework: 881. C# DLL에서 제공하는 Win32 export 함수의 내부 동작 방식(VT Fix up Table)파일 다운로드1
12126정성태1/25/202018431.NET Framework: 880. C# - PE 파일로부터 IMAGE_COR20_HEADER 및 VTableFixups 테이블 분석파일 다운로드1
12125정성태1/24/202015896VS.NET IDE: 141. IDE0019 - Use pattern matching
12124정성태1/23/202017680VS.NET IDE: 140. IDE1006 - Naming rule violation: These words must begin with upper case characters: ...
12123정성태1/23/202019413웹: 39. Google Analytics - gtag 함수를 이용해 페이지 URL 수정 및 별도의 이벤트 생성 방법 [2]
12122정성태1/20/202015511.NET Framework: 879. C/C++의 UNREFERENCED_PARAMETER 매크로를 C#에서 우회하는 방법(IDE0060 - Remove unused parameter '...')파일 다운로드1
12121정성태1/20/202016257VS.NET IDE: 139. Visual Studio - Error List: "Could not find schema information for the ..."파일 다운로드1
12120정성태1/19/202018664.NET Framework: 878. C# DLL에서 Win32 C/C++처럼 dllexport 함수를 제공하는 방법 - 네 번째 이야기(IL 코드로 직접 구현)파일 다운로드1
12119정성태1/17/202018866디버깅 기술: 160. Windbg 확장 DLL 만들기 (3) - C#으로 만드는 방법
12118정성태1/17/202019835개발 환경 구성: 466. C# DLL에서 Win32 C/C++처럼 dllexport 함수를 제공하는 방법 - 세 번째 이야기 [1]
12117정성태1/15/202018699디버깅 기술: 159. C# - 디버깅 중인 프로세스를 강제로 다른 디버거에서 연결하는 방법파일 다운로드1
12116정성태1/15/202019330디버깅 기술: 158. Visual Studio로 디버깅 시 sos.dll 확장 명령어를 (비롯한 windbg의 다양한 기능을) 수행하는 방법
12115정성태1/14/202019553디버깅 기술: 157. C# - PEB.ProcessHeap을 이용해 디버깅 중인지 확인하는 방법파일 다운로드1
12114정성태1/13/202021404디버깅 기술: 156. C# - PDB 파일로부터 심벌(Symbol) 및 타입(Type) 정보 열거 [1]파일 다운로드3
12113정성태1/12/202021461오류 유형: 590. Visual C++ 빌드 오류 - fatal error LNK1104: cannot open file 'atls.lib' [1]
12112정성태1/12/202016659오류 유형: 589. PowerShell - 원격 Invoke-Command 실행 시 "WinRM cannot complete the operation" 오류 발생
12111정성태1/12/202020453디버깅 기술: 155. C# - KernelMemoryIO 드라이버를 이용해 실행 프로그램을 숨기는 방법(DKOM: Direct Kernel Object Modification) [16]파일 다운로드1
12110정성태1/11/202019721디버깅 기술: 154. Patch Guard로 인해 블루 스크린(BSOD)가 발생하는 사례 [5]파일 다운로드1
12109정성태1/10/202016523오류 유형: 588. Driver 프로젝트 빌드 오류 - Inf2Cat error -2: "Inf2Cat, signability test failed."
12108정성태1/10/202017368오류 유형: 587. Kernel Driver 시작 시 127(The specified procedure could not be found.) 오류 메시지 발생
12107정성태1/10/202018486.NET Framework: 877. C# - 프로세스의 모든 핸들을 열람 - 두 번째 이야기
12106정성태1/8/202019581VC++: 136. C++ - OSR Driver Loader와 같은 Legacy 커널 드라이버 설치 프로그램 제작 [1]
... 61  62  63  64  65  66  67  68  69  70  71  [72]  73  74  75  ...