Find the answer to your Linux question:
Results 1 to 3 of 3
Newbie here. I added a user named mike and I was able to change his home directory to var/www/mikeshome but when mike connects via sftp he starts in mikeshome directory ...
  1. #1
    Just Joined!
    Join Date
    Apr 2008
    Posts
    4

    Only allow user access to specific directory

    Newbie here.

    I added a user named mike and I was able to change his home directory to var/www/mikeshome but when mike connects via sftp he starts in mikeshome directory but is able to go up a directory as well. I want to make mike only have access to mikeshome and all of its sub directories. I am on a RED Hat 5 machine using putty.

    Any help would be awesome.

    Thanks!

  2. #2
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    You need to configure the sftp server (openssh) to chroot the user into /var/www/mike. I have never done this myself so can't offer specific details on how to do it, but take a look at the articles on this page and they may help.

  3. #3
    Linux Newbie sarlacii's Avatar
    Join Date
    May 2005
    Location
    South Africa
    Posts
    110
    Greetings... not as simple as chroot'ing a user in vsftp or proftpd (uncomment a line, add some names...). LOL

    Open the file /etc/ssh/sshd_config and then check for the lines:

    Subsystem sftp /usr/lib/openssh/sftp-server
    or whatever matches your distro.

    Then check and uncomment or add the lines:

    Match User mike
    ChrootDirectory /var/www/mikeshome
    AllowTCPForwarding no
    X11Forwarding no
    ForceCommand /usr/lib/openssh/sftp-server
    for chroot by user, or else:

    Match Group mike
    ChrootDirectory /var/www/mikeshome
    AllowTCPForwarding no
    X11Forwarding no
    ForceCommand /usr/lib/openssh/sftp-server
    for chroot by group.

    Then restart the ssh server.

    Good luck.
    Respectfully... Sarlac II
    ~~
    The moving clock K' appears to K to run slow by the factor (1-v^2/c^2)^(1/2).
    This is the phenomenon of time dilation.
    The faster you run, the younger you look, to everyone but yourself.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...