• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How does “chmod -R 755” works

by admin

The permissions bits applied to a file system object correspond directly to the values which can be specified in the 4 digit tuple supplied to the chmod utility in the following command:

# chmod abcd [file system object]

Each value in the digit set abcd is made up of a sum of the values 1 2 and 4. By adding these values together for each digit, a value can be generated to set all file object attributes:

a – This digit controls special attribute settings. the value 1 sets the setuid bit, the value 2 sets the setgid bit, and the value 4 sets the sticky bit on the object.

b, c and d – These digits control read write and execute permissions for the file owner, the file owners primary group, and all other users. The value 4 enables read permission, the value 2 enables write permission, and the value 1 enables execute permission.

chmod -R 755

The -R option gives the permission recursively to all the files and folders under a directory. For example:

# chmod -R 755 /data01

The above command will recursively give 755 permission to /data01 directory along with all the files and directories present under it.

Other examples

1. To set a file file to be sticky, readable and writeable by the owner, readable by their primary group and inaccessible by everyone else:

# chmod 4610 filename

2. To give all permission to everyone on the system:

# chmod 0777 filename

For more information on chmod, see the chmod man page.

# man chmod

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to rotate /var/log/wtmp and /var/log/btmp file using logrotate
  2. How to Restrict su Access to a User Only by PAM in Linux
  3. Unable To Boot Up Linux OS with Auditd (CentOS/RHEL)
  4. What happens in the Background when you execute the “useradd” command under Linux
  5. How to configure VNC Server on CentOS/RHEL 6
  6. How to Setup SSH keys for “passwordless” SSH Login on CentOS/RHEL
  7. mpirun.openmpi: command not found
  8. chcon Command Examples in Linux
  9. How to activate and mount 2 Volume groups with same names in CentOS/RHEL
  10. How To Install Python 3 On CentOS 7 Using SCL

You May Also Like

Primary Sidebar

Recent Posts

  • ncat Command Examples in Linux
  • ncat: command not found
  • nautilus Command Examples in Linux
  • namei: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright