Skip to content

Instantly share code, notes, and snippets.

@WorldException
Created February 10, 2022 12:41
Show Gist options
  • Select an option

  • Save WorldException/c07d247ab529d6b7df1f5e779e9f81c8 to your computer and use it in GitHub Desktop.

Select an option

Save WorldException/c07d247ab529d6b7df1f5e779e9f81c8 to your computer and use it in GitHub Desktop.

Revisions

  1. WorldException created this gist Feb 10, 2022.
    10 changes: 10 additions & 0 deletions make_user.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/bin/bash

    groupadd ftponly
    useradd -s /bin/false uploader
    usermod -aG ftponly uploader
    passwd uploader
    chown root:root /home/uploader
    chmod 755 /home/uploader

    systemctl restart sshd
    11 changes: 11 additions & 0 deletions sshd_config
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    ...
    # override default of no subsystems
    # Subsystem sftp /usr/lib/openssh/sftp-server
    Subsystem sftp internal-sftp

    Match group ftponly
    ChrootDirectory %h
    ForceCommand internal-sftp
    AllowTcpForwarding no
    X11Forwarding no
    PermitTTY no