Ubuntu 18.04 – Change file permissions

Change permissions

If you want to change permissions you need to use chmod. File permissions explained in this post. You can change permissions using characters or number. Let’s see the chmod options for the permissions:

  • read – r or 4
  • write – w or 2
  • execute – x or 1

chmod options for user:

  • owner – u
  • group – g
  • other – o
  • all – a or ugo

chmod options for actions:

  • add permission – +
  • remove permission –
  • set permission – =

Examples with character options

chmod a+x xaa
  • a+x = for all users, add permission, execute permisssion
  • xaa = file name
change permissions with character and number options, <span>Ubuntu 18.04 – Change file permissions</span>, KandZ
chmod u-x xaa
  • u-x = for owner, remove permission, execute permission
  • xaa = file name
change permissions with character and number options, <span>Ubuntu 18.04 – Change file permissions</span>, KandZ
chmod o+wx xaa
  • o = others
  • + = add permission
  • wx = write and execute permissions
change permissions with character and number options, <span>Ubuntu 18.04 – Change file permissions</span>, KandZ

Examples with number options

If you plan to use the number options, then you need to add the numbers for each permission (see the first list). You need specify 3 numbers in a row, first number is for the owner, then for the group and the last number for the other.

Possible combinations

  • 7 = read(4) + write(2) + execute(1)
  • 6 = read(4) + write(2)
  • 5 = read(4) + execute(1)
  • 4 = read(4)
  • 3 = write(2) + execute(1)
  • 2 = write(2)
  • 1 = execute(1)
  • 0 = no permission
chmod 461 xaa
  • 4 = The first number is for the owner, and 4 is the number for read permission
  • 6 = The second number is for the group, and 6 is read permission(4) + write permission(2)
  • 1 = The third number is for the other, and 1 is for execute permission
change permissions with character and number options, <span>Ubuntu 18.04 – Change file permissions</span>, KandZ
chmod 756 xaa
  • 7 = read(4) + write(2) + execute(1)
  • 5 = read(4) + execute(1)
  • 6 = read(4) + write(2)
change permissions with character and number options, <span>Ubuntu 18.04 – Change file permissions</span>, KandZ

THE END!!!

68750cookie-checkUbuntu 18.04 – Change file permissionsUbuntu 18.04 – Change file permissions

Related posts

4 Thoughts to “Ubuntu 18.04 – Change file permissions

  1. […] Ubuntu 18.04 – Change file permissions […]

Comments are closed.