Skip to content

Instantly share code, notes, and snippets.

@muse-sisay
Created September 5, 2021 19:13
Show Gist options
  • Save muse-sisay/37297520b92ca0001b344c062303aed2 to your computer and use it in GitHub Desktop.
Save muse-sisay/37297520b92ca0001b344c062303aed2 to your computer and use it in GitHub Desktop.
LFCS objective: Find Command

1 = w
2 = x
3 = wx 4 = r
5 = rx
6 = rw
7 = rwx


page 2

perm

  • find . -perm 764 will match a file with the exact permission
  • find . -perm -764 will match any files with atleast rwx for the user, rw for the group and r for the world.
  • find . -perm /764 will match a file which contains any of rwx for user , rw for group , r for world.

ref


page 3

#!/bin/bash
for i in {0..7};do 
    for j in {0..7}; do
        for k in {0..7}; do
            touch file$h$i$j$k; 
            chmod $h$i$j$k file$h$i$j$k;
         done
    done 
done

Examples

$ find . -perm 646 

exact match 646, all ugo should match

$ find . -perm -646 # , 'rw' for user
$ find . -perm -u+rw,g+w,o+rw

u = 6 7
g = 4 5 6 7
o = 6 7

$ find . -perm /600

u = any of r or w , so 4 2 3 5 6 7
g = 0
o = 0

$ find . -perm /646

? need further reading


Tonight's Presenters

Felix Chinyama on d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment