1

I am trying to give user full access to specific directory.

I am using SFTP on Centos 7. I am creating new group and user

groupadd ftpusers
useradd -m newuser -s /sbin/nologin -g ftpusers

chown root "directory"
chmod 750 "directory"

My sshd_config contains:

Subsystem sftp internal-sftp
Match group ftpaccess
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

No matter what directory I put it gives me access to Home.

How can I make access to specific directory?

1
  • Please, clarify what is the question here. You specify chrootdirectory so the user does not have access anywhere else. If you specify different directory, he will have access to that directory.
    – Jakuje
    Jun 8, 2017 at 7:41

1 Answer 1

0

The line

ChrootDirectory %h

allows the access to the home directory of that user. If you want to give an access to different directory, just use

ChrootDirectory /full/path/to/directory
2
  • Hi, when I added directory as u suggested it wont connect the user.
    – Marto
    Jun 8, 2017 at 8:40
  • It obviously needs to point to the directory you created (with full path) and all of the parents needs to be owned by root and not writable by any other user.
    – Jakuje
    Jun 8, 2017 at 8:42

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