PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\Administrator> New-LocalGroup -Name "sftp_users" -Description "sftp only users"
Name Description
---- -----------
sftp_users sftp only users
PS C:\Users\Administrator> (Get-Content C:\ProgramData\ssh\sshd_config).Replace("Subsystem","#Subsystem") | Set-Content C:\ProgramData\ssh\sshd_config
PS C:\Users\Administrator> $str_document = @'
Subsystem sftp internal-sftp
Match Group sftp_users
AllowTcpForwarding no
ChrootDirectory C:\Users\%u
ForceCommand internal-sftp
'@
PS C:\Users\Administrator> $str_document | Add-Content C:\ProgramData\ssh\sshd_config
PS C:\Users\Administrator> Restart-Service -Name "sshd"
# 例として ユーザー [Serverworld] には SFTP のみを許可する
PS C:\Users\Administrator> Add-LocalGroupMember -Group "sftp_users" -Member "Serverworld"
|