Software & Apps Linux 127 127 people found this article helpful How to Use the chmod Command in Linux Change a file's permissions from the Linux command line by Juergen Haas Writer Former Lifewire writer Juergen Haas is a software developer, data scientist, and a fan of the Linux operating system. our editorial process Juergen Haas Updated on April 16, 2020 reviewed by Ryan Perian Lifewire Tech Review Board Member Ryan Perian is a certified IT specialist who holds numerous IT certifications and has 12+ years' experience working in the IT industry support and management positions. our review board Article reviewed on Apr 16, 2020 Ryan Perian Tweet Share Email Linux Switching from Windows In This Article Command Syntax and Options Command Examples Chgrp and newgrp Commands Setting Modes The chmod command changes the access permissions of files and folders. The chmod command, like other commands, can be executed from the command line or through a script file. If you need to list a file's permissions, use the ls command. Mykyta Dolmatov / Getty Images Command Syntax This is the proper syntax when using the chmod command: chmod [options] mode[,mode] file1 [file2 ...] The following are the usual options used with chmod: -f, --silent, --quiet: Suppresses most error messages. -v, --verbose: Outputs a diagnostic for every file processed. -c, --changes: Like verbose but reports only when a change is made. -R, --recursive: Changes files and directories recursively. --help: Displays help and exits. --version: Outputs version information and exits. Below is a list of numerical permissions that can be set for the user, group, and everyone else on the computer. Next to the number is the read, write, and execute letter equivalent. 7, rwx: Read, write, and execute. 6, rw-: Read and write. 5, r-x: Read and execute. 4, r--: Read-only. 3, -wx: Write and execute. 2, -w-: Write only. 1, --x: Execute only. 0, ---: None. Command Examples To change the permissions of the file participants so that everybody has full access to it, enter: chmod 777 participants The first 7 sets the permissions for the user, the second 7 sets the permissions for the group, and the third 7 sets the permissions for everybody else. If you want to be the only one who can access it, use: chmod 700 participants To give yourself and your group members full access, enter: chmod 770 participants If you want to keep full access for yourself, but want to keep other people from modifying the file, use: chmod 755 participants The following uses the letters from above to change the permissions of participants so that the owner can read and write to the file, but it doesn't change permissions for anyone else: chmod u=rw participants Chgrp and Newgrp Commands Change the group ownership of existing files and folders with the chgrp command. Change the default group for new files and folders with the newgrp command. Symbolic links used in a chmod command affect the target object. Setting Modes Use chmod to set additional file system modes for files and directories. For example, to set the sticky bit, prefix a 1 to the number sequence: chmod 1755 participants With a sticky bit, only the file owner, the directory owner, or the root superuser can delete the file, regardless of the file's read-and-write group permissions. Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Email Address Sign up There was an error. Please try again. You're in! Thanks for signing up. There was an error. Please try again. Thank you for signing up. Tell us why! Other Not enough details Hard to understand Submit