There are two key commands for working with file permissions on Linux, chmod
and chown
. For a brilliant summary of chmod see Tutorial for chmod.
One useful command for viewing file ownership and permissions is getfacl filename.ext
which gives a clear and handy summary, clearer than ls -l filename.ext
in my opinion. If you find the command does not work then you might need to install it, on Debian you need to do the following:apt install acl
chmod u+x myscript.sh
- add execute permissions for the current userchmod g-w example.txt
- remove write permissions for the groupchmod o-r example.txt
- remove read permission for all users except "group" and "user"