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

  • 相关阅读:
    phpStorm激活码
    找回自己
    延迟加载JavaScript
    [MAC]如何通过 macOS 恢复功能重新安装 macOS
    Realm JavaScript
    Realm .NET
    [MAC]获得在线帮助:恢复信息
    [Swift]UILabel文字截断
    算法和数据结构可视化
    Realm Swift
  • 原文地址:https://www.cnblogs.com/si812cn/p/sftp.html
Copyright © 2011-2022 走看看