2

I've set up SFTP/SSH so that a user can only put to their home directory, however, they can still cd to all other directories and get files that they see.

How can I prevent this?

EDIT:

My sshd_config: http://pastebin.com/jk7TCRZr

I've managed to lock to /var/www, but they can still view other user's folders.

EDIT 2:

Errm..... I just realized what I did wrong ... Ha ha

On another note, how could I make the public_html folder the folder that Apache tries to load data from?

3 Answers 3

0

You should configure sftp chroot.

2
  • That's what I've been trying to do for awhile now. Check the OP, just updated with link to my config.
    – David Harris
    Dec 28, 2012 at 12:43
  • Here's a link to show how this "chroot" thing works:thegeekstuff.com/2012/03/chroot-sftp-setup
    – Mats Petersson
    Dec 28, 2012 at 13:03
0

Or you can do it with tools like http://olivier.sessink.nl/jailkit/

0

Fixed.

I did the following (I probably shouldn't have, but it worked for me. That's all I want):

Match user myUser
    ChrootDirectory /var/www/myUser
    ForceCommand internal-sftp
    AllowTcpForwarding no
    GatewayPorts no
    X11Forwarding no

In /var/www/myUser, I created the dir public_html. After that, I enabled the userdir apache mod, like this:

sudo a2enmod userdir
sudo service apache2 restart

And everything just... Works!

(of course, this has the obvious down-side that we now have to prepend usernames with a tilde)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .