How can i change the permissions of directory public
to all users only read and only sudo
users (group members of sudo
) to only read/write access.
I prefer to do it like this :
chown root:sudo ~/public
How can i change the permissions of directory public
to all users only read and only sudo
users (group members of sudo
) to only read/write access.
I prefer to do it like this :
chown root:sudo ~/public
chmod and chgrp are the tools needed here:
Result:
Update
If you also want to prevent the current owner
pduck
from accessing the directory (regardless of his membership), then give the ownership toroot
:Now only
root
and members of thesudo
group have read/write access. Butroot
can access the directory anyway, even when he's not the owner, so this is safe.The first thought might be to keep the ownership and just reduce the rights:
Now – although the owner –
pduck
cannot access the directory. But (as owner) he can simply regain access by issuingchmod u+rwx public
himself, so this is not safe.