在Debian系统中,SFTP(SSH File Transfer Protocol)的配置主要通过修改sshd_config文件来实现。以下是一些常用的配置选项:
PortPort 2222ListenAddressListenAddress 192.168.1.100PermitRootLoginPermitRootLogin noPasswordAuthenticationPasswordAuthentication yesChallengeResponseAuthenticationChallengeResponseAuthentication noUsePAMUsePAM yesSubsystemSubsystem sftp /usr/lib/openssh/sftp-serverMatch UserMatch User user1,user2
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
ChrootDirectoryChrootDirectory /home/%uForceCommandForceCommand internal-sftpAllowTcpForwardingAllowTcpForwarding noX11ForwardingX11Forwarding noMaxSessionsMaxSessions 4MaxStartupsMaxStartups 10:30:60LogLevelLogLevel INFO# /etc/ssh/sshd_config
Port 2222
ListenAddress 192.168.1.100
PermitRootLogin no
PasswordAuthentication yes
ChallengeResponseAuthentication no
UsePAM yes
Subsystem sftp /usr/lib/openssh/sftp-server
Match User user1,user2
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
LogLevel INFO
sshd_config文件后,需要重启SSH服务以使更改生效:sudo systemctl restart sshd600:sudo chmod 600 /etc/ssh/sshd_config通过这些配置选项,你可以灵活地控制SFTP服务器的行为和安全性。