Linux - chmod - How to set file permissions ?

Linux - chmod - How to set file permissions ?


You can set file permissions with the chmod command. Both the root user and the file's owner can set file permissions.

chmod has two modes:

  • symbolic
  • and numeric.

The symbolic mode

The symbolic mode is pretty easy to remember. First, you decide if you set permissions for:

  • the user (u),
  • the group (g),
  • others (o),
  • or all of the three (a).

Then, you either:

  • add a permission (+),
  • remove it (-),
  • or wipe out the previous permissions and add a new one (=).

Next, you decide if you set:

  • the read permission (r),
  • write permission (w),
  • or execute permission (x).

Last, you'll tell chmod which file's permissions you want to change.

Examples on the file testfile with the permission -rwxrwxrwx.

Wipe out all the permissions but add read permission for everybody:

$ chmod a=r testfile

After the command, the file's permissions would be -r–r–r–

Add execute permissions for group:

$ chmod g+x testfile

Now, the file's permissions would be -r–r-xr–

Add both write and execute permissions for the file's owner. Note how you can set more than one permission at the same time:

$ chmod u+wx testfile

After this, the file permissions will be -rwxr-xr–

Remove the execute permission from both the file's owner and group. Note, again, how you can set them both at once:

$ chmod ug-x testfile

Now, the permissions are -rw-r–r–

Multiple modification at once

chmod u-x,g+rw,o-r testfile


chmod -R o+rw directory

Discover More
Linux - File/Folder Permissions - Access Control List ( ACL ) - Posix Model

In Linux, every object is a file. A directory or a folder is then also a file. Linux follows the POSIX permissions model. A permission is a combination between: an access right (read, write, execute)...
Linux - Samba - How to mount/map a Windows Share on Linux

Often you use a central Windows repository to save your installation file. In order to make them available to Linux, you can mount a Windows Share instead of to copy them. If you want to “map a drive”...
Obi Edition
OBIEE 10G - Linux OEL 5 x86 Installation version

Open the Set the JavaHome parameter to the point to the new JDK location. For example, . tail Oracle BI Java Host start-up details: /usr/local/OracleBIData/web/log/javahost.out.log Oracle BI Java...
Obiee 11.1 Internet Explorer 6 Not Supported
OBIEE 11g - Oracle Business Intelligence 11.1 Simple installation steps on Windows and OEL Linux 32 bit

Open the setSOADomainEnv.cmd file, located in your Update the PORT_MEM_ARGS entry as follows: set PORT_MEM_ARGS=-Xms512m -Xmx1024m Save the file and close. ;-) Oracle®...

Share this page:
Follow us:
Task Runner