From f51e74b592e4168a415fd6c8fb58b7bfd8e9b1ab Mon Sep 17 00:00:00 2001 From: SHM Date: Fri, 26 Jul 2024 18:13:26 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=84=B1=ED=98=84=EB=AA=A8]=20FTP=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=ED=99=94=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FTP/SetFTP.ps1 | 24 ++++++++++++++++++++++++ FTP/SetFTP_관리자권한으로실행.bat | 4 ++++ 2 files changed, 28 insertions(+) create mode 100644 FTP/SetFTP.ps1 create mode 100644 FTP/SetFTP_관리자권한으로실행.bat diff --git a/FTP/SetFTP.ps1 b/FTP/SetFTP.ps1 new file mode 100644 index 0000000..4d0d44c --- /dev/null +++ b/FTP/SetFTP.ps1 @@ -0,0 +1,24 @@ +$FTPSiteName='CPXV2_FTP' +$FTPRootDir='D:\FTP' +$FTPPort='2121' +New-WebFtpSite -Name $FTPSiteName -Port $FTPPort -PhysicalPath $FTPRootDir +Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/sites/site[@name='CPXV2_FTP']/ftpServer/security/authentication/anonymousAuthentication" -name "enabled" -value "True" + +$FTPSitePath = "IIS:\Sites\$FTPSiteName" +$BasicAuth = 'ftpServer.security.authentication.basicAuthentication.enabled' +Set-ItemProperty -Path $FTPSitePath -Name $BasicAuth -Value $True + +$Param = @{ + Filter = "/system.ftpServer/security/authorization" + Value = @{ + accessType = "Allow" + users = "*" + permissions = 3 + } + PSPath = 'IIS:\' + Location = $FTPSiteName +} +Add-WebConfiguration @param + +Set-ItemProperty -Path $FTPSitePath -Name 'ftpServer.security.ssl.controlChannelPolicy' -Value $false +Set-ItemProperty -Path $FTPSitePath -Name 'ftpServer.security.ssl.dataChannelPolicy' -Value $false \ No newline at end of file diff --git a/FTP/SetFTP_관리자권한으로실행.bat b/FTP/SetFTP_관리자권한으로실행.bat new file mode 100644 index 0000000..0ce0d52 --- /dev/null +++ b/FTP/SetFTP_관리자권한으로실행.bat @@ -0,0 +1,4 @@ +::FTP 명령어는 파워쉘로 넘겨서 실행해야한다. +::cmd에서는 불가. + +Powershell.exe -noprofile -executionpolicy bypass -file "d:\SetFTP.ps1" \ No newline at end of file