You are not logged in.

#1 2012-02-29 05:57:50

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

[Solved] OpenSSH Chroot for SFTP users - No Write Access

So I got this working ... kind of. I am able to connect and browse the directory, and download, but no matter what I do I can't seem to figure out how to give the users write access to the directory. Here is the relevant parts of my sshd_config

# override default of no subsystems
#Subsystem      sftp    /usr/lib/ssh/sftp-server
Subsystem       sftp    internal-sftp

# Rule to match users for the internal SFTP only group
Match Group sftp
PasswordAuthentication yes
ChrootDirectory /srv/ftp
AllowTCPForwarding no
X11Forwarding no
ForceCommand internal-sftp

Now, the directory itself is

drwxr-xr-x 3 root sftp 4096 Feb 29 00:09 ftp

but simply changing it for the group to have write access breaks the whole chroot and it fails to even connect. This makes sense, since in all the documentation I have seen online it states that the chroot must only be writable by root. If that's the case though, then how the hell do I give users permission to upload?

I've got to be missing something simple! hmm

Last edited by lifeafter2am (2012-02-29 14:43:54)


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#2 2012-02-29 09:43:44

schlumpfimsumpf
Member
Registered: 2011-08-13
Posts: 29

Re: [Solved] OpenSSH Chroot for SFTP users - No Write Access

As said in http://www.online-tutorials.net/interne … 9-324.html (first google hit) you just have to build a directory below your /srv/sftp with write access for your group or the users or whatever. For example i build a chroot for every usere i have with sftp access and mounted their home directory below that directory. So for my build /home/sftp/username ist not writable by the user but /home/sftp/username/username is and the users home directory is mounted there.

Offline

#3 2012-02-29 14:43:38

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

Re: [Solved] OpenSSH Chroot for SFTP users - No Write Access

I'm an idiot (or was just tired last night), because I did that and it still wasn't working. But what I forgot to do was to change the user that owned that directory .. I changed the group, just not the owner. Tis all working now ... ignore me.


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

Board footer

Powered by FluxBB