Can't access SFTP

Hello,

I created a standard user in HestiaCP, I added SSH Key, I can connect to SSH console with this user, but I can’t connect to SFTP.

I already red some topics here, but I don’t understand where is the issue.

User: stefano
I generated keys and I added the public key on Hestia:

I granted bash access on user:

I checked /home/stefano/.ssh/authorized_keys:

image

I checked /etc/ssh/sshd_config (where I didn’t change anything) and I noticed this:


there isn’t “stefano” user.

Connecting to SFTP using Filezilla:

Please Can you help me?

Thanks

Hi,

Run these commands and try again:

sed -i -E 's/(^Sub.*internal-sftp)(.*)/\1/' /etc/ssh/sshd_config
systemctl restart ssh
3 Likes

What does this command do? I don’t want to break compatibility with HestiaCP. Why do I need this command? Shouldn’t SFTP work by default?

Thanks

It’s a bug in Hestia that incorrectly adds the -server suffix to the directive Subsystem sftp internal-sftp. The sed command I posted removes that suffix.

4 Likes

I tried now before apply your modify and now it works!

I checked /etc/ssh/sshd_config and now I can see my user “stefano“:

is there a cron that edit this file? However keeping -server suffix on Subsystem sftp internal-sftp-server, it works fine.

That’s because you added the user to be jailed but the Subsystem directive must be fixed, you must remove -server

1 Like

I didn’t add any user in /etc/ssh/sshd_config manually….

I didn’t say you did it manually :wink:

1 Like

Did you say that I added the user to be jailed.. when? how? I don’t understand sorry :grinning_face_with_smiling_eyes:

Anyway I fixed it :wink:

Using command v-add-user-sftp-jail stefano or rebuilding the user (via command line or from Web UI).

1 Like

I never did It….

1 Like

I ran into this problem and, sure enough, this solution was perfect. It worked fine via SSH, but I had the same problem via SFTP. This fixed it.

Thanks :slight_smile:

1 Like

Keep in mind that this only fixes the outcome but does not solve the underlying problem. It could happen again, so until a new Hestia version is released, you can patch the current installation:

cd /usr/local/hestia/bin/
mv v-add-sys-sftp-jail v-add-sys-sftp-jail.ori
curl -sSL https://raw.githubusercontent.com/hestiacp/hestiacp/b7b2f3b10cbfd5b727bb8cb835bc236bdfbc6660/bin/v-add-sys-sftp-jail -o v-add-sys-sftp-jail
chmod +x v-add-sys-sftp-jail
3 Likes

As always, thank you.

I thought it was a permanent fix, but indeed, it can happen in a Hestia update.
I’ll keep that in mind.
I’ve applied the patch you suggested.
Thank you for the explanation and guidance.

1 Like

I signed up to this forum just to thank you sahsanu.

You saved the day

2 Likes

thank you. this saved my day about SFTP problem with Filezilla

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.