在Debian系统中,SFTP(SSH File Transfer Protocol)的配置主要通过修改sshd_config文件来实现。以下是一些常用的配置参数及其说明:
PortPort 22ListenAddressListenAddress 192.168.1.100PermitRootLoginPermitRootLogin noPasswordAuthenticationPasswordAuthentication yesChallengeResponseAuthenticationChallengeResponseAuthentication noUsePAMUsePAM yesSubsystem sftpSubsystem sftp internal-sftpMatch GroupMatch Group sftpusers
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
ChrootDirectoryChrootDirectory /home/%uForceCommandForceCommand internal-sftpAllowTcpForwardingAllowTcpForwarding noX11ForwardingX11Forwarding noMaxSessionsMaxSessions 4MaxStartupsMaxStartups 10:30:60LogLevelLogLevel INFO打开sshd_config文件:
sudo nano /etc/ssh/sshd_config
根据需要修改上述参数。
保存并关闭文件。
重新加载或重启SSH服务以应用更改:
sudo systemctl reload sshd
或者
sudo systemctl restart sshd
请注意,修改配置文件时要小心,确保语法正确,否则可能导致SSH服务无法启动。建议在修改前备份原始文件。