This repository has been archived on 2023-05-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Vps-UBUNTU-SetupScripts/resources/sftp_without_root.sh
2018-08-30 07:42:06 +00:00

32 lines
938 B
Bash

#==============================================================================
# UBUNTU 18.04 - SFTP ACCES WITHOUT ROOT OR SSH
# https://www.digitalocean.com/community/tutorials/how-to-enable-sftp-without-shell-access-on-ubuntu-18-04
#==============================================================================
echo Username?
read user
echo domein voor toegang?
read domain
adduser $user
chown root:root /var/www
chmod 755 /var/www
chown $user:$user /var/www/$domain
cat <<EOF > /etc/ssh/sshd_config
PasswordAuthentication yes
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
PermitRootLogin yes
Match User $user
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/www
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
EOF
systemctl restart sshd