Centos navigate SFTP User to have access to specific directory

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?

Marto

Posted 2017-06-07T16:56:39.013

Reputation: 11

Question was closed 2017-06-16T09:12:10.183

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 – 2017-06-08T07:41:38.333

Answers

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

Jakuje

Posted 2017-06-07T16:56:39.013

Reputation: 7 981

Hi, when I added directory as u suggested it wont connect the user. – Marto – 2017-06-08T08:40:09.337

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 – 2017-06-08T08:42:32.170