Help! User Permission

Christian Walther cptsalek at gmail.com
Wed Apr 4 11:36:05 UTC 2007


On 04/04/07, Andrew Pantyukhin <infofarmer at freebsd.org> wrote:
> On 4/4/07, VeeJay <maanjee at gmail.com> wrote:
> > Hello friends
> >
> > How can I restrict a user from getting in to an "Unauthorized folder" and
> > getting directory list with using "ls" command?
> >
> > If he tries to cd to the unauthorized folder or tries to get directory
> > listing so he gets "Permission denied" message?
>
> "chmod a-rwx folder" to deny all access to everybody,
> then "chmod u+rwx folder" and "chown gooduser folder"
> to permit a good user (and only him) to access it.

Another option would be to remove access rights from "others" and make
sure that the owner and group of the directory in question is set to
something that excludes the user.
If you want to allow access to a directory to only one user, the
method described above is correct. But it doesn't work in case you
want to prevent just one user from accessing a directory, but allow
some others to do so.
In the latter case you could create a group, for example "files", and
you could add all users that are allowed to access the directory to
this group. Then you chgrp the directory, do a chmod 750 on the
directory, and you're set.
chmod 750 actually prevents the group from writing to the directory,
so if you want all group members to be able to write to this
directory, use 770 instead.
For more details please read some basic Unix manual, or check the
manpages for pw, chmod, chown, chgrp...

HTH
Christian


More information about the freebsd-questions mailing list