-
Using the CHMOD command effectively
Can’t remember how to calculate which CHMOD command you want to use. Below you will find every possible CHMOD command and the file permissions they will set. Along with a simple explanation on how to use chmod, every possible combination is listed below.
The permission mode is computed by adding up the following values for the user, the file group, and for everyone else (AKA: other, everyone or world can all apply).
- Read 4 – Allowed to read files
- Write 2 – Allowed to write/modify files
- eXecute1 – Read/write/delete/modify/directory
Example 1:user group world r+w r 4+2+0 4+0+0 0+0+0 = 640 Example 2:
user group world r+w+x w+x x 4+2+1 0+2+1 0+0+1 = 731 Now some explanations:
Mode Str Perms Explanation 0477 ‐r‐‐rwxrwx owner has read only (4), group and others have rwx (7) 0677 ‐rw‐rwxrwx owner has rw only(6), group and others have rwx (7) 0444 ‐r‐‐r‐‐r‐‐ all have read only (4) 0666 ‐rw‐rw‐rw‐ all have rw only (6) 0400 ‐r‐‐‐‐‐‐‐‐ owner has read only(4), group and others have no permission(0) 0600 ‐rw‐‐‐‐‐‐‐ owner has rw only, group and others have no permission 0470 ‐r‐‐rwx‐‐‐ owner has read only, group has rwx, others have no permission 0407 ‐r‐‐‐‐‐rwx owner has read only, group has no permission, other has rwx 0670 ‐rw‐rwx‐‐‐ owner has rw only, group has rwx, other has no permission 0607 ‐rw‐‐‐‐rwx owner has rw only, group has no permission and others have rwx 0624 ‐rw‐‐w‐r‐‐ owner has rw only, group has only w and others only have r 0777 ‐rwxrwxrwx Everyone has all access, use with caution
chmod 0 | ‐‐‐‐‐‐‐‐‐‐ chmod 1 | ‐‐‐‐‐‐‐‐‐x chmod 2 | ‐‐‐‐‐‐‐‐w‐ chmod 3 | ‐‐‐‐‐‐‐‐wx chmod 4 | ‐‐‐‐‐‐‐r‐‐ chmod 5 | ‐‐‐‐‐‐‐r‐x chmod 6 | ‐‐‐‐‐‐‐rw‐ chmod 7 | ‐‐‐‐‐‐‐rwx chmod 10 | ‐‐‐‐‐‐x‐‐‐ chmod 11 | ‐‐‐‐‐‐x‐‐x chmod 12 | ‐‐‐‐‐‐x‐w‐ chmod 13 | ‐‐‐‐‐‐x‐wx chmod 14 | ‐‐‐‐‐‐xr‐‐ chmod 15 | ‐‐‐‐‐‐xr‐x chmod 16 | ‐‐‐‐‐‐xrw‐ chmod 17 | ‐‐‐‐‐‐xrwx chmod 20 | ‐‐‐‐‐w‐‐‐‐ chmod 21 | ‐‐‐‐‐w‐‐‐x chmod 22 | ‐‐‐‐‐w‐‐w‐ chmod 23 | ‐‐‐‐‐w‐‐wx chmod 24 | ‐‐‐‐‐w‐r‐‐ chmod 25 | ‐‐‐‐‐w‐r‐x chmod 26 | ‐‐‐‐‐w‐rw‐ chmod 27 | ‐‐‐‐‐w‐rwx chmod 30 | ‐‐‐‐‐wx‐‐‐ chmod 31 | ‐‐‐‐‐wx‐‐x chmod 32 | ‐‐‐‐‐wx‐w‐ chmod 33 | ‐‐‐‐‐wx‐wx chmod 34 | ‐‐‐‐‐wxr‐‐ chmod 35 | ‐‐‐‐‐wxr‐x chmod 36 | ‐‐‐‐‐wxrw‐ chmod 37 | ‐‐‐‐‐wxrwx chmod 40 | ‐‐‐‐r‐‐‐‐‐ chmod 41 | ‐‐‐‐r‐‐‐‐x chmod 42 | ‐‐‐‐r‐‐‐w‐ chmod 43 | ‐‐‐‐r‐‐‐wx chmod 44 | ‐‐‐‐r‐‐r‐‐ chmod 45 | ‐‐‐‐r‐‐r‐x chmod 46 | ‐‐‐‐r‐‐rw‐ chmod 47 | ‐‐‐‐r‐‐rwx chmod 50 | ‐‐‐‐r‐x‐‐‐ chmod 51 | ‐‐‐‐r‐x‐‐x chmod 52 | ‐‐‐‐r‐x‐w‐ chmod 53 | ‐‐‐‐r‐x‐wx chmod 54 | ‐‐‐‐r‐xr‐‐ chmod 55 | ‐‐‐‐r‐xr‐x chmod 56 | ‐‐‐‐r‐xrw‐ chmod 57 | ‐‐‐‐r‐xrwx chmod 60 | ‐‐‐‐rw‐‐‐‐ chmod 61 | ‐‐‐‐rw‐‐‐x chmod 62 | ‐‐‐‐rw‐‐w‐ chmod 63 | ‐‐‐‐rw‐‐wx chmod 64 | ‐‐‐‐rw‐r‐‐ chmod 65 | ‐‐‐‐rw‐r‐x chmod 66 | ‐‐‐‐rw‐rw‐ chmod 67 | ‐‐‐‐rw‐rwx chmod 70 | ‐‐‐‐rwx‐‐‐ chmod 71 | ‐‐‐‐rwx‐‐x chmod 72 | ‐‐‐‐rwx‐w‐ chmod 73 | ‐‐‐‐rwx‐wx chmod 74 | ‐‐‐‐rwxr‐‐ chmod 75 | ‐‐‐‐rwxr‐x chmod 76 | ‐‐‐‐rwxrw‐ chmod 77 | ‐‐‐‐rwxrwx chmod 100 | ‐‐‐x‐‐‐‐‐‐ chmod 101 | ‐‐‐x‐‐‐‐‐x chmod 102 | ‐‐‐x‐‐‐‐w‐ chmod 103 | ‐‐‐x‐‐‐‐wx chmod 104 | ‐‐‐x‐‐‐r‐‐ chmod 105 | ‐‐‐x‐‐‐r‐x chmod 106 | ‐‐‐x‐‐‐rw‐ chmod 107 | ‐‐‐x‐‐‐rwx chmod 110 | ‐‐‐x‐‐x‐‐‐ chmod 111 | ‐‐‐x‐‐x‐‐x chmod 112 | ‐‐‐x‐‐x‐w‐ chmod 113 | ‐‐‐x‐‐x‐wx chmod 114 | ‐‐‐x‐‐xr‐‐ chmod 115 | ‐‐‐x‐‐xr‐x chmod 116 | ‐‐‐x‐‐xrw‐ chmod 117 | ‐‐‐x‐‐xrwx chmod 120 | ‐‐‐x‐w‐‐‐‐ chmod 121 | ‐‐‐x‐w‐‐‐x chmod 122 | ‐‐‐x‐w‐‐w‐ chmod 123 | ‐‐‐x‐w‐‐wx chmod 124 | ‐‐‐x‐w‐r‐‐ chmod 125 | ‐‐‐x‐w‐r‐x chmod 126 | ‐‐‐x‐w‐rw‐ chmod 127 | ‐‐‐x‐w‐rwx chmod 130 | ‐‐‐x‐wx‐‐‐ chmod 131 | ‐‐‐x‐wx‐‐x chmod 132 | ‐‐‐x‐wx‐w‐ chmod 133 | ‐‐‐x‐wx‐wx chmod 134 | ‐‐‐x‐wxr‐‐ chmod 135 | ‐‐‐x‐wxr‐x chmod 136 | ‐‐‐x‐wxrw‐ chmod 137 | ‐‐‐x‐wxrwx chmod 140 | ‐‐‐xr‐‐‐‐‐ chmod 141 | ‐‐‐xr‐‐‐‐x chmod 142 | ‐‐‐xr‐‐‐w‐ chmod 143 | ‐‐‐xr‐‐‐wx chmod 144 | ‐‐‐xr‐‐r‐‐ chmod 145 | ‐‐‐xr‐‐r‐x chmod 146 | ‐‐‐xr‐‐rw‐ chmod 147 | ‐‐‐xr‐‐rwx chmod 150 | ‐‐‐xr‐x‐‐‐ chmod 151 | ‐‐‐xr‐x‐‐x chmod 152 | ‐‐‐xr‐x‐w‐ chmod 153 | ‐‐‐xr‐x‐wx chmod 154 | ‐‐‐xr‐xr‐‐ chmod 155 | ‐‐‐xr‐xr‐x chmod 156 | ‐‐‐xr‐xrw‐ chmod 157 | ‐‐‐xr‐xrwx chmod 160 | ‐‐‐xrw‐‐‐‐ chmod 161 | ‐‐‐xrw‐‐‐x chmod 162 | ‐‐‐xrw‐‐w‐ chmod 163 | ‐‐‐xrw‐‐wx chmod 164 | ‐‐‐xrw‐r‐‐ chmod 165 | ‐‐‐xrw‐r‐x chmod 166 | ‐‐‐xrw‐rw‐ chmod 167 | ‐‐‐xrw‐rwx chmod 170 | ‐‐‐xrwx‐‐‐ chmod 171 | ‐‐‐xrwx‐‐x chmod 172 | ‐‐‐xrwx‐w‐ chmod 173 | ‐‐‐xrwx‐wx chmod 174 | ‐‐‐xrwxr‐‐ chmod 175 | ‐‐‐xrwxr‐x chmod 176 | ‐‐‐xrwxrw‐ chmod 177 | ‐‐‐xrwxrwx chmod 200 | ‐‐w‐‐‐‐‐‐‐ chmod 201 | ‐‐w‐‐‐‐‐‐x chmod 202 | ‐‐w‐‐‐‐‐w‐ chmod 203 | ‐‐w‐‐‐‐‐wx chmod 204 | ‐‐w‐‐‐‐r‐‐ chmod 205 | ‐‐w‐‐‐‐r‐x chmod 206 | ‐‐w‐‐‐‐rw‐ chmod 207 | ‐‐w‐‐‐‐rwx chmod 210 | ‐‐w‐‐‐x‐‐‐ chmod 211 | ‐‐w‐‐‐x‐‐x chmod 212 | ‐‐w‐‐‐x‐w‐ chmod 213 | ‐‐w‐‐‐x‐wx chmod 214 | ‐‐w‐‐‐xr‐‐ chmod 215 | ‐‐w‐‐‐xr‐x chmod 216 | ‐‐w‐‐‐xrw‐ chmod 217 | ‐‐w‐‐‐xrwx chmod 220 | ‐‐w‐‐w‐‐‐‐ chmod 221 | ‐‐w‐‐w‐‐‐x chmod 222 | ‐‐w‐‐w‐‐w‐ chmod 223 | ‐‐w‐‐w‐‐wx chmod 224 | ‐‐w‐‐w‐r‐‐ chmod 225 | ‐‐w‐‐w‐r‐x chmod 226 | ‐‐w‐‐w‐rw‐ chmod 227 | ‐‐w‐‐w‐rwx chmod 230 | ‐‐w‐‐wx‐‐‐ chmod 231 | ‐‐w‐‐wx‐‐x chmod 232 | ‐‐w‐‐wx‐w‐ chmod 233 | ‐‐w‐‐wx‐wx chmod 234 | ‐‐w‐‐wxr‐‐ chmod 235 | ‐‐w‐‐wxr‐x chmod 236 | ‐‐w‐‐wxrw‐ chmod 237 | ‐‐w‐‐wxrwx chmod 240 | ‐‐w‐r‐‐‐‐‐ chmod 241 | ‐‐w‐r‐‐‐‐x chmod 242 | ‐‐w‐r‐‐‐w‐ chmod 243 | ‐‐w‐r‐‐‐wx chmod 244 | ‐‐w‐r‐‐r‐‐ chmod 245 | ‐‐w‐r‐‐r‐x chmod 246 | ‐‐w‐r‐‐rw‐ chmod 247 | ‐‐w‐r‐‐rwx chmod 250 | ‐‐w‐r‐x‐‐‐ chmod 251 | ‐‐w‐r‐x‐‐x chmod 252 | ‐‐w‐r‐x‐w‐ chmod 253 | ‐‐w‐r‐x‐wx chmod 254 | ‐‐w‐r‐xr‐‐ chmod 255 | ‐‐w‐r‐xr‐x chmod 256 | ‐‐w‐r‐xrw‐ chmod 257 | ‐‐w‐r‐xrwx chmod 260 | ‐‐w‐rw‐‐‐‐ chmod 261 | ‐‐w‐rw‐‐‐x chmod 262 | ‐‐w‐rw‐‐w‐ chmod 263 | ‐‐w‐rw‐‐wx chmod 264 | ‐‐w‐rw‐r‐‐ chmod 265 | ‐‐w‐rw‐r‐x chmod 266 | ‐‐w‐rw‐rw‐ chmod 267 | ‐‐w‐rw‐rwx chmod 270 | ‐‐w‐rwx‐‐‐ chmod 271 | ‐‐w‐rwx‐‐x chmod 272 | ‐‐w‐rwx‐w‐ chmod 273 | ‐‐w‐rwx‐wx chmod 274 | ‐‐w‐rwxr‐‐ chmod 275 | ‐‐w‐rwxr‐x chmod 276 | ‐‐w‐rwxrw‐ chmod 277 | ‐‐w‐rwxrwx chmod 300 | ‐‐wx‐‐‐‐‐‐ chmod 301 | ‐‐wx‐‐‐‐‐x chmod 302 | ‐‐wx‐‐‐‐w‐ chmod 303 | ‐‐wx‐‐‐‐wx chmod 304 | ‐‐wx‐‐‐r‐‐ chmod 305 | ‐‐wx‐‐‐r‐x chmod 306 | ‐‐wx‐‐‐rw‐ chmod 307 | ‐‐wx‐‐‐rwx chmod 310 | ‐‐wx‐‐x‐‐‐ chmod 311 | ‐‐wx‐‐x‐‐x chmod 312 | ‐‐wx‐‐x‐w‐ chmod 313 | ‐‐wx‐‐x‐wx chmod 314 | ‐‐wx‐‐xr‐‐ chmod 315 | ‐‐wx‐‐xr‐x chmod 316 | ‐‐wx‐‐xrw‐ chmod 317 | ‐‐wx‐‐xrwx chmod 320 | ‐‐wx‐w‐‐‐‐ chmod 321 | ‐‐wx‐w‐‐‐x chmod 322 | ‐‐wx‐w‐‐w‐ chmod 323 | ‐‐wx‐w‐‐wx chmod 324 | ‐‐wx‐w‐r‐‐ chmod 325 | ‐‐wx‐w‐r‐x chmod 326 | ‐‐wx‐w‐rw‐ chmod 327 | ‐‐wx‐w‐rwx chmod 330 | ‐‐wx‐wx‐‐‐ chmod 331 | ‐‐wx‐wx‐‐x chmod 332 | ‐‐wx‐wx‐w‐ chmod 333 | ‐‐wx‐wx‐wx chmod 334 | ‐‐wx‐wxr‐‐ chmod 335 | ‐‐wx‐wxr‐x chmod 336 | ‐‐wx‐wxrw‐ chmod 337 | ‐‐wx‐wxrwx chmod 340 | ‐‐wxr‐‐‐‐‐ chmod 341 | ‐‐wxr‐‐‐‐x chmod 342 | ‐‐wxr‐‐‐w‐ chmod 343 | ‐‐wxr‐‐‐wx chmod 344 | ‐‐wxr‐‐r‐‐ chmod 345 | ‐‐wxr‐‐r‐x chmod 346 | ‐‐wxr‐‐rw‐ chmod 347 | ‐‐wxr‐‐rwx chmod 350 | ‐‐wxr‐x‐‐‐ chmod 351 | ‐‐wxr‐x‐‐x chmod 352 | ‐‐wxr‐x‐w‐ chmod 353 | ‐‐wxr‐x‐wx chmod 354 | ‐‐wxr‐xr‐‐ chmod 355 | ‐‐wxr‐xr‐x chmod 356| ‐‐wxr‐xrw‐ chmod 357 | ‐‐wxr‐xrwx chmod 360 | ‐‐wxrw‐‐‐‐ chmod 361 | ‐‐wxrw‐‐‐x chmod 362 | ‐‐wxrw‐‐w‐ chmod 363 | ‐‐wxrw‐‐wx chmod 364 | ‐‐wxrw‐r‐‐ chmod 365 | ‐‐wxrw‐r‐x chmod 366 | ‐‐wxrw‐rw‐ chmod 367 | ‐‐wxrw‐rwx chmod 370 | ‐‐wxrwx‐‐‐ chmod 371 | ‐‐wxrwx‐‐x chmod 372 | ‐‐wxrwx‐w‐ chmod 373 | ‐‐wxrwx‐wx chmod 374 | ‐‐wxrwxr‐‐ chmod 375 | ‐‐wxrwxr‐x chmod 376 | ‐‐wxrwxrw‐ chmod 377 | ‐‐wxrwxrwx chmod 400 | ‐r‐‐‐‐‐‐‐‐ chmod 401 | ‐r‐‐‐‐‐‐‐x chmod 402 | ‐r‐‐‐‐‐‐w‐ chmod 403 | ‐r‐‐‐‐‐‐wx chmod 404 | ‐r‐‐‐‐‐r‐‐ chmod 405 | ‐r‐‐‐‐‐r‐x chmod 406 | ‐r‐‐‐‐‐rw‐ chmod 407 | ‐r‐‐‐‐‐rwx chmod 410 | ‐r‐‐‐‐x‐‐‐ chmod 411 | ‐r‐‐‐‐x‐‐x chmod 412 | ‐r‐‐‐‐x‐w‐ chmod 413 | ‐r‐‐‐‐x‐wx chmod 414 | ‐r‐‐‐‐xr‐‐ chmod 415 | ‐r‐‐‐‐xr‐x chmod 416 | ‐r‐‐‐‐xrw‐ chmod 417 | ‐r‐‐‐‐xrwx chmod 420 | ‐r‐‐‐w‐‐‐‐ chmod 421 | ‐r‐‐‐w‐‐‐x chmod 422 | ‐r‐‐‐w‐‐w‐ chmod 423 | ‐r‐‐‐w‐‐wx chmod 424 | ‐r‐‐‐w‐r‐‐ chmod 425 | ‐r‐‐‐w‐r‐x chmod 426 | ‐r‐‐‐w‐rw‐ chmod 427 | ‐r‐‐‐w‐rwx chmod 430 | ‐r‐‐‐wx‐‐‐ chmod 431 | ‐r‐‐‐wx‐‐x chmod 432 | ‐r‐‐‐wx‐w‐ chmod 433 | ‐r‐‐‐wx‐wx chmod 434 | ‐r‐‐‐wxr‐‐ chmod 435 | ‐r‐‐‐wxr‐x chmod 436 | ‐r‐‐‐wxrw‐ chmod 437 | ‐r‐‐‐wxrwx chmod 440 | ‐r‐‐r‐‐‐‐‐ chmod 441 | ‐r‐‐r‐‐‐‐x chmod 442 | ‐r‐‐r‐‐‐w‐ chmod 443 | ‐r‐‐r‐‐‐wx chmod 444 | ‐r‐‐r‐‐r‐‐ chmod 445 | ‐r‐‐r‐‐r‐x chmod 446 | ‐r‐‐r‐‐rw‐ chmod 447 | ‐r‐‐r‐‐rwx chmod 450 | ‐r‐‐r‐x‐‐‐ chmod 451 | ‐r‐‐r‐x‐‐x chmod 452 | ‐r‐‐r‐x‐w‐ chmod 453 | ‐r‐‐r‐x‐wx chmod 454 | ‐r‐‐r‐xr‐‐ chmod 455 | ‐r‐‐r‐xr‐x chmod 456 | ‐r‐‐r‐xrw‐ chmod 457 | ‐r‐‐r‐xrwx chmod 460 | ‐r‐‐rw‐‐‐‐ chmod 461 | ‐r‐‐rw‐‐‐x chmod 462 | ‐r‐‐rw‐‐w‐ chmod 463 | ‐r‐‐rw‐‐wx chmod 464 | ‐r‐‐rw‐r‐‐ chmod 465 | ‐r‐‐rw‐r‐x chmod 466 | ‐r‐‐rw‐rw‐ chmod 467 | ‐r‐‐rw‐rwx chmod 470 | ‐r‐‐rwx‐‐‐ chmod 471 | ‐r‐‐rwx‐‐x chmod 472 | ‐r‐‐rwx‐w‐ chmod 473 | ‐r‐‐rwx‐wx chmod 474 | ‐r‐‐rwxr‐‐ chmod 475 | ‐r‐‐rwxr‐x chmod 476 | ‐r‐‐rwxrw‐ chmod 477 | ‐r‐‐rwxrwx chmod 500 | ‐r‐x‐‐‐‐‐‐ chmod 501 | ‐r‐x‐‐‐‐‐x chmod 502 | ‐r‐x‐‐‐‐w‐ chmod 503 | ‐r‐x‐‐‐‐wx chmod 504 | ‐r‐x‐‐‐r‐‐ chmod 505 | ‐r‐x‐‐‐r‐x chmod 506 | ‐r‐x‐‐‐rw‐ chmod 507 | ‐r‐x‐‐‐rwx chmod 510 | ‐r‐x‐‐x‐‐‐ chmod 511 | ‐r‐x‐‐x‐‐x chmod 512 | ‐r‐x‐‐x‐w‐ chmod 513 | ‐r‐x‐‐x‐wx chmod 514 | ‐r‐x‐‐xr‐‐ chmod 515 | ‐r‐x‐‐xr‐x chmod 516 | ‐r‐x‐‐xrw‐ chmod 517 | ‐r‐x‐‐xrwx chmod 520 | ‐r‐x‐w‐‐‐‐ chmod 521 | ‐r‐x‐w‐‐‐x chmod 522 | ‐r‐x‐w‐‐w‐ chmod 523 | ‐r‐x‐w‐‐wx chmod 524 | ‐r‐x‐w‐r‐‐ chmod 525 | ‐r‐x‐w‐r‐x chmod 526 | ‐r‐x‐w‐rw‐ chmod 527 | ‐r‐x‐w‐rwx chmod 530 | ‐r‐x‐wx‐‐‐ chmod 531 | ‐r‐x‐wx‐‐x chmod 532 | ‐r‐x‐wx‐w‐ chmod 533 | ‐r‐x‐wx‐wx chmod 534 | ‐r‐x‐wxr‐‐ chmod 535 | ‐r‐x‐wxr‐x chmod 536 | ‐r‐x‐wxrw‐ chmod 537 | ‐r‐x‐wxrwx chmod 540 | ‐r‐xr‐‐‐‐‐ chmod 541 | ‐r‐xr‐‐‐‐x chmod 542 | ‐r‐xr‐‐‐w‐ chmod 543 | ‐r‐xr‐‐‐wx chmod 544 | ‐r‐xr‐‐r‐‐ chmod 545 | ‐r‐xr‐‐r‐x chmod 546 | ‐r‐xr‐‐rw‐ chmod 547 | ‐r‐xr‐‐rwx chmod 550 | ‐r‐xr‐x‐‐‐ chmod 551 | ‐r‐xr‐x‐‐x chmod 552 | ‐r‐xr‐x‐w‐ chmod 553 | ‐r‐xr‐x‐wx chmod 554 | ‐r‐xr‐xr‐‐ chmod 555 | ‐r‐xr‐xr‐x chmod 556 | ‐r‐xr‐xrw‐ chmod 557 | ‐r‐xr‐xrwx chmod 560 | ‐r‐xrw‐‐‐‐ chmod 561 | ‐r‐xrw‐‐‐x chmod 562 | ‐r‐xrw‐‐w‐ chmod 563 | ‐r‐xrw‐‐wx chmod 564 | ‐r‐xrw‐r‐‐ chmod 565 | ‐r‐xrw‐r‐x chmod 566 | ‐r‐xrw‐rw‐ chmod 567 | ‐r‐xrw‐rwx chmod 570 | ‐r‐xrwx‐‐‐ chmod 571 | ‐r‐xrwx‐‐x chmod 572 | ‐r‐xrwx‐w‐ chmod 573 | ‐r‐xrwx‐wx chmod 574 | ‐r‐xrwxr‐‐ chmod 575 | ‐r‐xrwxr‐x chmod 576 | ‐r‐xrwxrw‐ chmod 577 | ‐r‐xrwxrwx chmod 600 | ‐rw‐‐‐‐‐‐‐ chmod 601 | ‐rw‐‐‐‐‐‐x chmod 602 | ‐rw‐‐‐‐‐w‐ chmod 603 | ‐rw‐‐‐‐‐wx chmod 604 | ‐rw‐‐‐‐r‐‐ chmod 605 | ‐rw‐‐‐‐r‐x chmod 606 | ‐rw‐‐‐‐rw‐ chmod 607 | ‐rw‐‐‐‐rwx chmod 610 | ‐rw‐‐‐x‐‐‐ chmod 611 | ‐rw‐‐‐x‐‐x chmod 612 | ‐rw‐‐‐x‐w‐ chmod 613 | ‐rw‐‐‐x‐wx chmod 614 | ‐rw‐‐‐xr‐‐ chmod 615 | ‐rw‐‐‐xr‐x chmod 616 | ‐rw‐‐‐xrw‐ chmod 617 | ‐rw‐‐‐xrwx chmod 620 | ‐rw‐‐w‐‐‐‐ chmod 621 | ‐rw‐‐w‐‐‐x chmod 622 | ‐rw‐‐w‐‐w‐ chmod 623 | ‐rw‐‐w‐‐wx chmod 624 | ‐rw‐‐w‐r‐‐ chmod 625 | ‐rw‐‐w‐r‐x chmod 626 | ‐rw‐‐w‐rw‐ chmod 627 | ‐rw‐‐w‐rwx chmod 630 | ‐rw‐‐wx‐‐‐ chmod 631 | ‐rw‐‐wx‐‐x chmod 632 | ‐rw‐‐wx‐w‐ chmod 633 | ‐rw‐‐wx‐wx chmod 634 | ‐rw‐‐wxr‐‐ chmod 635 | ‐rw‐‐wxr‐x chmod 636 | ‐rw‐‐wxrw‐ chmod 637 | ‐rw‐‐wxrwx chmod 640 | ‐rw‐r‐‐‐‐‐ chmod 641 | ‐rw‐r‐‐‐‐x chmod 642 | ‐rw‐r‐‐‐w‐ chmod 643 | ‐rw‐r‐‐‐wx chmod 644 | ‐rw‐r‐‐r‐‐ chmod 645 | ‐rw‐r‐‐r‐x chmod 646 | ‐rw‐r‐‐rw‐ chmod 647 | ‐rw‐r‐‐rwx chmod 650 | ‐rw‐r‐x‐‐‐ chmod 651 | ‐rw‐r‐x‐‐x chmod 652 | ‐rw‐r‐x‐w‐ chmod 653 | ‐rw‐r‐x‐wx chmod 654 | ‐rw‐r‐xr‐‐ chmod 655 | ‐rw‐r‐xr‐x chmod 656 | ‐rw‐r‐xrw‐ chmod 657 | ‐rw‐r‐xrwx chmod 660 | ‐rw‐rw‐‐‐‐ chmod 661 | ‐rw‐rw‐‐‐x chmod 662 | ‐rw‐rw‐‐w‐ chmod 663 | ‐rw‐rw‐‐wx chmod 664 | ‐rw‐rw‐r‐‐ chmod 665 | ‐rw‐rw‐r‐x chmod 666 | ‐rw‐rw‐rw‐ chmod 667 | ‐rw‐rw‐rwx chmod 670 | ‐rw‐rwx‐‐‐ chmod 671 | ‐rw‐rwx‐‐x chmod 672 | ‐rw‐rwx‐w‐ chmod 673 | ‐rw‐rwx‐wx chmod 674 | ‐rw‐rwxr‐‐ chmod 675 | ‐rw‐rwxr‐x chmod 676 | ‐rw‐rwxrw‐ chmod 677 | ‐rw‐rwxrwx chmod 700 | ‐rwx‐‐‐‐‐‐ chmod 701 | ‐rwx‐‐‐‐‐x chmod 702 | ‐rwx‐‐‐‐w‐ chmod 703 | ‐rwx‐‐‐‐wx chmod 704 | ‐rwx‐‐‐r‐‐ chmod 705 | ‐rwx‐‐‐r‐x chmod 706 | ‐rwx‐‐‐rw‐ chmod 707 | ‐rwx‐‐‐rwx chmod 710 | ‐rwx‐‐x‐‐‐ chmod 711 | ‐rwx‐‐x‐‐x chmod 712 | ‐rwx‐‐x‐w‐ chmod 713 | ‐rwx‐‐x‐wx chmod 714 | ‐rwx‐‐xr‐‐ chmod 715 | ‐rwx‐‐xr‐x chmod 716 | ‐rwx‐‐xrw‐ chmod 717 | ‐rwx‐‐xrwx chmod 720 | ‐rwx‐w‐‐‐‐ chmod 721 | ‐rwx‐w‐‐‐x chmod 722 | ‐rwx‐w‐‐w‐ chmod 723 | ‐rwx‐w‐‐wx chmod 724 | ‐rwx‐w‐r‐‐ chmod 725 | ‐rwx‐w‐r‐x chmod 726 | ‐rwx‐w‐rw‐ chmod 727 | ‐rwx‐w‐rwx chmod 730 | ‐rwx‐wx‐‐‐ chmod 731 | ‐rwx‐wx‐‐x chmod 732 | ‐rwx‐wx‐w‐ chmod 733 | ‐rwx‐wx‐wx chmod 734 | ‐rwx‐wxr‐‐ chmod 735 | ‐rwx‐wxr‐x chmod 736 | ‐rwx‐wxrw‐ chmod 737 | ‐rwx‐wxrwx chmod 740 | ‐rwxr‐‐‐‐‐ chmod 741 | ‐rwxr‐‐‐‐x chmod 742 | ‐rwxr‐‐‐w‐ chmod 743 | ‐rwxr‐‐‐wx chmod 744 | ‐rwxr‐‐r‐‐ chmod 745 | ‐rwxr‐‐r‐x chmod 746 | ‐rwxr‐‐rw‐ chmod 747 | ‐rwxr‐‐rwx chmod 750 | ‐rwxr‐x‐‐‐ chmod 751 | ‐rwxr‐x‐‐x chmod 752 | ‐rwxr‐x‐w‐ chmod 753 | ‐rwxr‐x‐wx chmod 754 | ‐rwxr‐xr‐‐ chmod 755 | ‐rwxr‐xr‐x chmod 756 | ‐rwxr‐xrw‐ chmod 757 | ‐rwxr‐xrwx chmod 760 | ‐rwxrw‐‐‐‐ chmod 761 | ‐rwxrw‐‐‐x chmod 762 | ‐rwxrw‐‐w‐ chmod 763 | ‐rwxrw‐‐wx chmod 764 | ‐rwxrw‐r‐‐ chmod 765 | ‐rwxrw‐r‐x chmod 766 | ‐rwxrw‐rw‐ chmod 767 | ‐rwxrw‐rwx chmod 770 | ‐rwxrwx‐‐‐ chmod 771 | ‐rwxrwx‐‐x chmod 772 | ‐rwxrwx‐w‐ chmod 773 | ‐rwxrwx‐wx chmod 774 | ‐rwxrwxr‐‐ chmod 775 | ‐rwxrwxr‐x chmod 776 | ‐rwxrwxrw‐ chmod 777 | ‐rwxrwxrwx
CHMOD also has the ability to be run as alphanumeric/symbolic mode. You may have seen commands such as:
chmod a+w
chmod o-x
chmod +X
chmod =rwThese are modifiers to the current permissions. For example:
chmod a+w will add WRITE (2) permissions to EVERYONE. So if your permissions before were 644, they would now become 666 after that command was run.chmod o-x will remove EXECUTE (1) from the other (world) group. If your permissions before were 777, they would now become 776.
chmod +X is an EXECUTE modifier and will add EXECUTE (1) to EVERYONE who DOES NOT have the permission already. So if your permissions before were 742, they would now become 753. If no one has EXECUTE, nothing will change.
chmod =rw will set READ (4) and WRITE (2) to the usual defaults. On a mac this will mean if you have file with 000, it will set it to 644. Group and Other do not get write if it is not a default for them, which is is not on a default OSX setup.
Personally I find it MUCH easier to just use the numbers but it is important to understand those other modifiers, even if it is just the basics. Why would you want to use this method unless you absolutely need to, so instead of chmod 755 you would have to type:
chmod u=rwx,go=rx OR u=rwx,go=u-w
Or what about chmod 765:
chmod u=rwx,g=rw,o=rx OR u=rwx,g=u-x,o=u-w OR …
So what are the most common permissions? Well it depends on the server, your setup and what you want to do.
In your local user folder, your folders will likely be 755 and your files will be 644 on most servers. If you wanted to restrict things to just your user, you could set 700 on your folders and 600 on your files.When it comes to web servers, this is where things can start to vary as the permissions could be based on your user or the web server group or the web server owner or another… In a lot of cases, www-data will be the default owner of the /var/www/ folder, if you don’t want to mess around with the apache settings, this is your default. The best settings in this case are 664 on files and 775 on folders, this gives both the www-data user and www-data group access to the files and folders. If you do not want the website to be able to write to certain folders, 555 would be a better setting, and you would use 444 on files that you do not want written by the web process. That last group setting can probably be made 0, as nothing other than the web process really should be hitting your files or folders. If the ownership of the files is split between your user and www-data (or another ‘web’ process), the following permissions would allow you to edit the files but not allow the web group to write – 755 on folders and 644 on files.
Despite lots of people saying set 777 for website folder permissions, here is a reason why you should think twice on a web enabled folder. Hacker finds a vulnerability on your website and a folder with 777 permission. He uploads a php script that they can now execute as any user (thanks to you giving it execute permissions) and if they can access a shell user via an exploit that can execute shell commands they can take over or best case scenario they can just upload malicious code or content.
So what is the + at the end of my permissions?
You may notice a + at the end of your permissions like this:
-rwxrwxr-x+
This + on your permissions means there is an associated ACL on the file/directory in question. ACL’s are used when the basic permissions are not enough. You can view the ACL with getfacl on *nix and ‘ls -le .’ on MAC.
11 responses to “Using the CHMOD command effectively”
-
I was attempting to find out why permission #’s 466 & 220 would likely not be used?
I would greatly appreciate any assistance you can provide.
-
George Gates January 17th, 2013 at 11:56
I understand the three permissions together like r= read w=write x=execute (rwx). But I can’t seem to grasp 4 permissions like (rwxr).What is the function of the extra “r”? Thanks for any information
Another example: rwxrw seems to have the read/write permission twice. Again, thanks for any information
-
Hi,
There is no need to write out all these codes, they are easy to calculate in your head or on a piece of paper.
I will give a brief explanation:As you have described the permissions are usually displayed as nine letters in a combination of ‘r’ ‘w’ or ‘x’, there is sometimes a seventh letter at the beginning, if for example the first letter is ‘d’ you are looking at a directory(d for directory) etc.
The nine permissions are split into groups of three, the first three are the permissions for the owner of the file or directory, the second three are permissions for a user and the last three are known as ‘world’ permissions (I think of these as guest log-ins to the machine).
So a permissions list which looks like this:
rwxr–r–
Gives the owner of the file/directory all permissions read write and execute(the first group of three letters), users(second group r–) and guests(last group r–) on the machine have only read permissions.
To calculate the code you want just split these three and treat them as separate entities. Now think back to school when you learned about binary code for conversion between base 10 numbers (everyday 1-10) and base 2 numbers (binary or machine code).
take the first group of three letters from the example (rwx) the x represents a 1, the w represents a 2 and the r represents a 4 (like in binary) so to give all permissions we use the number 4+2+1=7. Repeat this process for the other user groups and combine we get (rwxr–r– == 744 : each group of three represents one number).
-
This was very informative, thank you!
I would suggest you edit the section where you say, “Now some explanations:”.
In several of those examples you describe the explanation putting others/world as the second item where it would be easier for novices to follow if you always gave User then Group then World/Others.
for examle this one you gave:
0407 -r—–rwx owner has read only, other has rwx, group has no permission
would be better as:
0407 -r—–rwx owner has read only, group has no permission, other has rwx.
It would be clearer and the reader wouldn’t have to adjust the position of the values or worse misconstrue the answer.
Very nice guide, either way. :)
-
renatto October 9th, 2013 at 11:53
i wanna make a .sh and want a grup to execute it and other be able only to read it is 756 ok?
-
sandeeep March 16th, 2015 at 05:31
Hi
i am provide me right for permission read only
-
Great resource, thanks!
For those not wanting to do the calculation in their head, simply text search this page [Ctrl+F] and start typing the permissions you want to locate the associated number.
HOWEVER! Please can you re-publish with — not conflated into a single dash please in order to make it searchable?
i.e. -r–r—– is actually -r–r—–Fixed width font on the table would be a further improvement.
Leave a reply
Christina April 10th, 2012 at 12:54