Results 1 to 4 of 4
Hello,
I'm trying to get ChrootDirectory working with SFTP. I understand the chroot directory is not writable by the user, so I have to create a sub-directory the user is ...
- 07-21-2011 #1Just Joined!
- Join Date
- Jul 2011
- Posts
- 2
OpenSSH SFTP Chroot Help
Hello,
I'm trying to get ChrootDirectory working with SFTP. I understand the chroot directory is not writable by the user, so I have to create a sub-directory the user is supposed to write to. I keeping getting write permission denied when uploading a file to this sub directory?
Does anybody have any suggestions on how to troubleshoot this or know what i'm doing wrong? Here's how I have it setup.
Fedora 15, OpenSSH 5.6p1
/etc/ssh/sshd_config looks like this
I created the sftp group and created a test user.Code:Subsystem sftp internal-sftp Match Group sftp ChrootDirectory %h X11Forwarding no AllowTcpForwarding no ForceCommand internal-sftp
Then gave root access to the test user's home directory so chroot will work.Code:groupadd sftp useradd -g sftp -s /bin/false -d /home/test test
Since the user's home directory is the chroot directory, the user will not have write access to it. So I created a sub-directory that the user will have write access to.Code:chown root:root /home/test chmod 755 /home/test
I can successfully sftp into the server and download files. But I cannot upload files to the data directory? I get write permission denied.Code:mkdir /home/test/data chown test:test /home/test/data chmod 755 /home/test/data
Please help!
- 07-21-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
I followed your exact steps on my F15 box and was able to upload files as user test successfully, with two caveats:
1. In that last chown command, did you mean2. Do you have SELinux enabled? I have it disabled. Check withCode:chown test:sftp /home/test/data
If enabled, temporarily disable it withCode:getenforce
If it proves to be the problem, and you don't need it, permanently disable it by setting "SELINUX=disabled" in /etc/selinux/configCode:setenforce 0
- 07-23-2011 #3Just Joined!
- Join Date
- Jul 2011
- Posts
- 2
Thank You
atreyu,
Thank You! You solved the issue. SELinux was interfering. As soon as i disabled it, i was able to write.
To answer question #1, you're correct, I meant to chown test:sftp /home/test/data
Thanks!!!
- 07-24-2011 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
...cheers!


1Likes
Reply With Quote