In Linux, files and directories are owned by a user and a group (see File Ownership). On top of that, this user, group, and other ones (groups and users), have different permissions on these files. That's what we call file permissions. You might need to change them. If this can be boring to new users, remember that this is a huge part of what makes Linux as secured as it is, and you are required to know this if you wish to do anything serious with Linux.
ls -al /path/to/file/or/dir
- First character is a a
-for files, or a
- Three next ones are owner permissions:
- Three next ones are group permissions:
- Three next ones are "others permissions:
rwxfor groups and users that are now owning the file
- First user listed is the owner
- Next entry is the group owning the file
"r" stands for "read", "w" stands for "write", "x" stands for execute. If any letter from
rwxis showed as a
-, it means that the permission is not granted.
Change permissions from files or directories
-Rto your chmod
Set all permissions at once
First number is for user, second is for group, third for others
0 no permissions
Default permissions are 755. If you wish to prevent other users from interacting with your files, then 750 can be great.
chmod -R 750 /home/userdir
rwxfor these, but of course, you should pick the permissions you wish to add or remove.
chmod +rwx filenameWill add read, write, and execute permissions to this file anyone on the machine. r stands for "read", w for "write", and x for "execute"
chmod +x filenameWill make the file executable by anyone on the machine.
chmod -rwx filenameWill remove read, write, and execute permissions to this file anyone on the machine. Note : root user is the only exception.
Of course, you can replace
+rwxby anything previously mentioned
Advanced permissions management, you will likely not need this for game servers.
chmod -R a-s /path/to/dir
chmod -R 0xxx /path/to/dir
chmod -R 0640 /home/user/website
Files will run as the user
chmod -R u+s /path/to/dir/
chmod -R 2xxx /path/to/dir
Any subdir and subfile will have the same group
chmod -R g+s /path/to/dir/
chmod -R 4xxx /path/to/dir
Set both UID and GID
chmod -R a+s /path/to/dir/
chmod -R 6xxx /path/to/dir