I want to give my friend access to a single folder on my server.
I created a new user for him, created a new group for him, and chgrp -R
'd the folder for him so that he would have access.
I just tried SSHing in as him, and he can see everything on my server. He can see all the directories, cat
, and download files. The only thing he can't seem to do is modify or create files.
How can I remove access for him from everything except his home folder and this special folder for which he is in the group of?
Here's what I've done, I ran nano /etc/ssh/sshd_config
and added this to the bottom:
Match group GROUP
ChrootDirectory /srv/WEBSITE
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
And then ran service ssh restart
.
Now I can't log in as my friend using WinSCP.
chroot
environment for this user. See here: http://unix.stackexchange.com/questions/9853/restricting-an-ssh-scp-sftp-user-to-a-directory – noleti Apr 29 '15 at 01:35www-data
to be able to read/write to that directory. – mpen Apr 29 '15 at 01:43chmod -R o-rwx /
(i.e. on the root folder) safe to do? – mpen Apr 29 '15 at 01:47www-data
can have write right to the directory content, but not to the parent directories. The point is to prevent another user from redirecting the path to another folder on the filesystem vialn -s
or similar. – noleti Apr 29 '15 at 01:47chmod
commands you mention. That is a sure way to mess up your system beyond recovery. – noleti Apr 29 '15 at 01:48chmod -R o-rwx /
which removes read/write/execute permissions for "other users". Would that not remove access for my friend? – mpen Apr 29 '15 at 01:56