SFTP not working (but SSH does)

Hello,

I installed Hestiacp, so far working (ubuntu 24 lts) ; i can connect to the panel, I can connect with the root account in SSH… but I can’t connect with sftp as root (nor with any user account) ; did i misses something ? I didn’t changed any files. Firewall allows port 22. I have no error message, just the connexion never starts. SSH (same passwords) working great so i am a little bit lost… If someone could please help me out ?

1 Like

same thing happen to me. even few mints go i was using Sftp as root but after restart the server its stop working.
in putty SSH is working i can connect fine.
but when im using Sftp (FileZilla) im getting error
Error: Could not connect to server

pls help to fix it

1 Like

Show the output of this command:

grep -i sftp /etc/ssh/sshd_config

here

# Hestia SFTP Chroot
Match User sftp_dummy99,adminpro,admin2,admin123pohub,adminhdflix,adminapi,admin7,admin5,admin4,admin6,admin3,admin8
ForceCommand internal-sftp -d /home/%u

I have the following

root@hetzner-cp2 ~ # grep -i sftp /etc/ssh/sshd_config
Subsystem sftp internal-sftp-server
# Hestia SFTP Chroot
Match User sftp_dummy99,client,synexta
ForceCommand internal-sftp -d /home/%u

It’s strange that you don’t have the Subsystem directive.

Show all the contents of the file.

grep -Ev '^#|^$' /etc/ssh/sshd_config

Output is

root@hetzner-cp2 ~ # grep -Ev '^#|^$' /etc/ssh/sshd_config
Include /etc/ssh/sshd_config.d/*.conf
LoginGraceTime 1m
PermitRootLogin yes
KbdInteractiveAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
DebianBanner no
AcceptEnv LANG LC_*
Subsystem sftp internal-sftp-server
 
Match User sftp_dummy99,client,synexta
    ChrootDirectory /srv/jail/%u
    X11Forwarding no
    AllowTCPForwarding no
    ForceCommand internal-sftp -d /home/%u

Use these commands to fix it.

sed -i 's/internal-sftp-server/internal-sftp/' /etc/ssh/sshd_config
systemctl restart ssh
6 Likes

Working thanks ! where is the error from ? because i just made a clean install following the installation script…

1 Like

worked thank you sir

It’s a bug that will be fixed in next release.

2 Likes

my first experience in Hestiacp… just hugely appreciate the support, thanks !

1 Like

Subsystem sftp /usr/lib/sftp-server-server

I noticed that after the update the sftp line was updated and became incorrect. I corrected it and sftp worked from the root user. I haven’t tested it for others.

That case is also fixed in the PR.

1 Like

Hi. I also seem unable to connect by regular ftp account since v1.9.3
tried to solve with the sed cmd, restarted ssh and vsftpd to no avail

I keep getting timed out :
Error: Connection timed out after 20 seconds of inactivity
Error: Could not connect to server

Tried adding new user, after deleting old ones, still no luck.

Which ftp server are you using (vsftpd or proftpd)?

systemctl status vsftpd --no-pager -l

or

systemctl status proftpd --no-pager -l

Additionally:

lsof -Pn +c0 -i:21 -sTCP:LISTEN
iptables -S | grep -E ' --dport.*( 21[ ,]|12000:)'

Using vsftpd :

● vsftpd.service - vsftpd FTP server
     Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2025-03-27 23:18:11 CET; 43min ago
   Main PID: 364394 (vsftpd)
      Tasks: 1 (limit: 9439)
     Memory: 1.6M
        CPU: 31ms
     CGroup: /system.slice/vsftpd.service
             └─364394 /usr/sbin/vsftpd /etc/vsftpd.conf

Mar 27 23:18:11 wel.allemachtig.com systemd[1]: Starting vsftpd FTP server...
Mar 27 23:18:11 wel.allemachtig.com systemd[1]: Started vsftpd FTP server.
root@wel:~# lsof -Pn +c0 -i:21 -sTCP:LISTEN
COMMAND    PID USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
vsftpd  364394 root    3u  IPv4 178150160      0t0  TCP *:21 (LISTEN)

and

root@wel:~# iptables -S | grep -E ' --dport.*( 21[ ,]|12000:)'
-A INPUT -p tcp -m tcp --dport 21 -j fail2ban-FTP
-A INPUT -p tcp -m multiport --dports 21,12000:12100 -j ACCEPT

All looks fine.

Could you please create a test user so I can check the ftp connection from my end? You can share the domain and password sending to me a private message.

Sent you a message. Had a test user already

It works fine for me:

❯ lftp -u 'test,pass' ftp://144.xxx.76.xxx -e 'set ssl:verify-certificate false'
lftp [email protected]:~> ls
drwxr-x--x    2 1002     1002         4096 Jan 02  2020 cgi-bin
drwxr-x--x    2 1002     1002         4096 Feb 28 05:11 document_errors
drwxr-x--x    2 1002     1002         4096 Feb 28 05:11 logs
drwxr-x--x   14 1002     1002         4096 Oct 16  2021 private
lrwxrwxrwx    1 1002     33             17 Oct 25  2023 public_html -> releases/current/
drwxr-x--x    2 1002     33           4096 Jan 02  2020 public_shtml
drwxr-xr-x    4 1002     1002         4096 Oct 25  2023 releases
drwxr-x--x   21 1002     1002         4096 Mar 27 23:39 stats