
Ubuntu 18.04 서버가 있고 vsftpd를 설치했습니다.
이 튜토리얼에 따라 새 FTP 사용자를 만들었습니다.https://devanswers.co/installing-ftp-server-vsftpd-ubuntu-18-04/
사용자를 폴더에 잠그고 싶지만 /var/www/html/mydomain.com/
파일에 무엇을 설정했는지에 관계없이 잠글 수 없습니다 /etc/vsftpd.conf
.
예를 들어 다음 제안을 시도했습니다.
write_enable=YES
local_umask=022
chroot_local_user=YES
allow_writeable_chroot=YES
나는 또한 다음을 추가해 보았습니다.
local_root=/
또는
local_root=/var/www/html/mydomain.com/
사용자는 성공적으로 로그인할 수 있지만 어떤 폴더에도 잠글 수 없습니다. 어떤 조언이라도 좋을 것입니다. 감사해요.
답변1
몇 시간의 검색 끝에 나는 스스로 답을 찾았습니다.
터미널에서 실행:
sudo nano /etc/ssh/sshd_config
파일 끝에 다음을 추가합니다.
Match User yourusername
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/www/html/yourdomain.com/
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
yourusername을 생성한 ftp 사용자의 이름으로 바꾸고 ChrootDirectory 경로도 바꿉니다.
터미널에서 실행:
sudo systemctl restart sshd
자세한 내용은 여기를 참조하세요:https://www.digitalocean.com/community/tutorials/how-to-enable-sftp-without-shell-access-on-ubuntu-18-04