0

I'm configuring SFTP in ubuntu 18.04 following this tutorial (https://www.digitalocean.com/community/tutorials/how-to-enable-sftp-without-shell-access-on-ubuntu-18-04) But when I try to connect from a FileZilla I get this error "Received unexpected end-of-file from SFTP server" And when I try to connect from terminal I get this error "/bin/bash: No such file or directory"

this is my "sshd_config":

Match User my-user
PasswordAuthentication yes
ChrootDirectory /var/www 
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no

If I comment #ChrootDirectory, everything works like a charm, ... well no like a charm because then I have access to every file in ubuntu, which is not good for security reasons

File permission for "www" folder drwxr-xr-x 4 root root 4096 Aug 27 11:57 www

File permission for "www/webapi" drwxr-xr-x 2 file-upload file-upload 4096 Aug 29 09:00 webapi

this is not working for me: SSH Fails, /bin/bash: No such file or directory

Any idea what am I missing ??? Thank you !!!

  • for a chroot to work you normally need the binary(s), + possible libs inside the chroot if you want to execute command within the chrooted environment. – Dennis Nolte Aug 29 '18 at 10:50
0

I found a solution hope it helps someone else

open sshd_config file with sudo privileges sudo nano /etc/ssh/sshd_config

#Subsystem sftp /usr/lib/openssh/sftp-server <- comment this
Subsystem sftp internal-sftp   <- add this line

Then apply a restart: sudo systemctl restart vsftpd.service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.