centos

centos sftp配置中如何设置传输速率

小樊
32
2025-11-21 22:15:02
栏目: 智能运维

在CentOS系统中,通过修改SSH配置文件(通常位于/etc/ssh/sshd_config)可以设置SFTP传输速率

  1. 打开SSH配置文件:
sudo vi /etc/ssh/sshd_config
  1. 在文件中找到或添加以下配置项:
Match Group sftp_users
    ChrootDirectory %h
    ForceCommand internal-sftp
    AllowTcpForwarding no
    X11Forwarding no
    MaxSessions 10
    MaxStartups 10:30:60
    Ciphers aes128-ctr,aes192-ctr,aes256-ctr
    MACs hmac-sha1,hmac-sha2-256
    KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
    ControlMaster auto
    ControlPath /tmp/ssh_mux_%r@%h:%p
    ControlPersist 1h

这里的配置项解释如下:

  1. 保存并关闭文件。

  2. 重启SSH服务以应用更改:

sudo systemctl restart sshd
  1. 创建一个名为sftp_users的用户组,并将需要限制速率的用户添加到该组:
sudo groupadd sftp_users
sudo usermod -aG sftp_users your_username

your_username替换为实际的用户名。

  1. 为用户设置密码:
sudo passwd your_username

按照提示输入新密码。

现在,您已经成功设置了CentOS系统中SFTP用户的传输速率。请注意,这些设置仅适用于使用SFTP的用户。对于使用SCP或其他传输方式的用户,您需要在其他地方进行配置。

0
看了该问题的人还看了