Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I added the below to sshd_config, when i chmod 770 the user folder i get this error? Why? how can i make the folder only readable to the user or group? the owner currently is root and the group is currently that username

fatal: bad ownership or modes for chroot directory

-edit- this is for a user to sftp to store files. Only that user or that group should access that folder. i dont understand why i cant change the permission from 755 to 775 either. Adding write permission gives me an error when i try to log in as the user.

sshd_config:

Match group SomeGroup
         ChrootDirectory /mnt/somedir/%u
         X11Forwarding no
         AllowTcpForwarding no
         ForceCommand internal-sftp
share|improve this question
    
There is no need to have write permission for user (or in this case user group). Actually, it's pretty bad idea, because otherwise user is able to modify files in that directory. –  Olli Apr 2 '11 at 19:49
    
@Olli: Well, its his storage... he should be able to modify all the files he wants... and no one else should see it –  acidzombie24 Apr 2 '11 at 20:18

1 Answer 1

From the sshd_config(5) man page:

 ChrootDirectory
         Specifies a path to chroot(2) to after authentication.  This
         path, and all its components, must be root-owned directories that
         are not writable by any other user or group.

You need to turn off the group-write bit.

share|improve this answer
    
how do i do that? –  acidzombie24 Apr 3 '11 at 0:42
    
You want the permissions to be 750, and the user should be a member of the group. For more details, see undeadly.org/cgi?action=article&sid=20080220110039 –  justarobert Apr 3 '11 at 5:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.