How To Set File Permissions In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Use the chmod command: The chmod command is used to change the permissions of a file or directory. The syntax is
$ chmod [who][operator][permissions] [file/directory]
For example, to give the user read and write permissions and the group and others read permissions to a file named “myfile”, you would use the following command:
$ chmod u=rw,g=r,o=r myfile
2. Use the chown command: The chown command is used to change the ownership of a file or directory. The syntax is
$ chown [owner][:group] [file/directory]
For example, to change the owner of a file named “myfile” to the user “bob”, you would use the following command:
$ chown bob myfile