Windows11 或windows server 16及以上如何配置ssh实现sftp服务搭建

时间:2025-03-04 07:02:27

配置SFTP访问权限。

  • 打开PowerShell命令提示符(以管理员身份运行)。
  • 编辑SSH服务器配置文件sshd_config,在此文件中配置SFTP访问权限。
    notepad C:\ProgramData\ssh\sshd_config
    

  • 在文件中添加以下行:
    Match user your_username
    ForceCommand internal-sftp
    PasswordAuthentication yes
    ChrootDirectory %UserProfile%
    AllowAgentForwarding no
    AllowTcpForwarding no
    X11Forwarding no
    

    your_username替换为您要配置SFTP访问权限的用户名。
  • 保存并关闭文件。