zoukankan      html  css  js  c++  java
  • sftp配置多个用户权限的问题

    groupadd group1

    chmod 0755 /test/
    useradd -g group1 -d /test/backend/ -M test_backend
    usermod -s /sbin/nologin test_backend
    passwd test_backend
    xxxxxxxx

    useradd -g group1 -d /test/api/ -M test_api
    usermod -s /sbin/nologin test_api
    passwd test_api
    xxxxxx

    useradd -g group1 -d /test/business/ -M test_business
    usermod -s /sbin/nologin test_business
    passwd test_business
    xxxxxx


    vi /etc/ssh/sshd_config

    UseDNS no
    AddressFamily inet
    SyslogFacility AUTHPRIV
    PermitRootLogin yes
    PasswordAuthentication yes

    # override default of no subsystems
    # Subsystem sftp /usr/libexec/openssh/sftp-server
    Subsystem sftp internal-sftp

    Match User test_backend
    ChrootDirectory /test/backend
    X11Forwarding no
    AllowTcpForwarding no
    ForceCommand internal-sftp
    Match User test_api
    ChrootDirectory /test/api
    X11Forwarding no
    AllowTcpForwarding no
    ForceCommand internal-sftp
    Match User test_business
    ChrootDirectory /test/business
    X11Forwarding no
    AllowTcpForwarding no
    ForceCommand internal-sftp

    systemctl restart sshd

    这里有几点

    1、主目录的所有者必须为root

    即 chown root:root /test

    2、权限为chmod 755 /test

    3、要想让sftp修改子目录,只能创建子目录来设置权限

    mkdir /test/api/project01

    chown test_api:group1 /test/api/project01

    chmod 755 /test/api/project01

  • 相关阅读:
    C++格式化输入输出
    算法的时间复杂度和空间复杂度
    C++编程中const和#define的区别
    C#中结构体和类的区别
    SQL之删除触发器
    Windows添加和取消右键管理员权限
    SQL之trigger(触发器)
    SQL VIEW(视图)
    二分查找的实现
    C++中this指针
  • 原文地址:https://www.cnblogs.com/si812cn/p/sftp.html
Copyright © 2011-2022 走看看