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
ultimatebyte@game:~$ ls -al twserver-rwxr-x--- 1 ultimatebyte ultimatebyte 5691 Jan 30 01:14 twserver
First character is a a
- for files, or a
d for directories
Three next ones are owner permissions:
Three next ones are group permissions:
Three next ones are "others permissions:
rwx for 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
rwx is showed as a
-, it means that the permission is not granted.
Change permissions from files or directories
-R to your chmod
Set all permissions at once
chmod 777 ==
chmod 000 ==
First number is for user, second is for group, third for others
0 no permissions1 x2 w3 wx4 r5 rx6 rw7 rwx
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
rwx for these, but of course, you should pick the permissions you wish to add or remove.
chmod +rwx filename
Will 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 filename
Will make the file executable by anyone on the machine.
chmod -rwx filename Will 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
+rwx by 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