Saturday, August 5, 2023

Kali linux terminal commands - file, folder access management

Kali Linux - file, folder access management

permission          on a file                                                 on a folder/directory
r (read)         
        read file content (cat)                             read directory content (ls)
w (write)         
      change file content (vi/touch)                 create file in directory (vi/touch)
x (execute)         
  execute the file (script/program)            enter the directory (cd)

binary     octal     permissions
000          0            ---
001          1            --x
010          2            -w-
011          3            -wx
100         4            r--
101         5            r-x
110         6            rw-
111         7            rwx


    777 = rwxrwxrwx  
    666 = rw-rw-rw-  
    555 = r-xr-xr-x  
    444 = r--r--r--    
    333 = -wx-wx-wx
    222 = -w--w--w-
    111 = --x--x--x
    000 = ---------


chmod [permission] [filename]

chmod 777 tor-browser-linux64-12.0.4_ALL.tar.xz     

chmod u+x 001.sh        permission granted to execute added to user
chmod a+x 001.sh        permission granted to execute added to All (user, group, others)    

chmod g-x 001.sh        permission to execute is revoked from the group
chmod u-w 001.sh       permission to write os revoked from the user

chmod a+x 001.sh
or
chmod +x 001.sh         execute permission given for all the groups


u - user    g - group    o - other    a = all

chmod u=wx file                      permission granted for user with write and execute
chmod g=rw file                      
permission granted for group with read and write
chmod u=rwx.g=rw,o=r file      permission granted for user, group and other with different access

chmod 777 *.sh                       permission granted group of files
chmod u=rwx.g=rw,o=r *.txt    permission granted group of files

cp -p file1 file2                        copy file permision and apply to other files
mkdir -m 777 dirname            assign file access permission while creating directory/folder

No comments:

Post a Comment

Kali linux - protonvpn setup

Kali linux - protonvpn setup  to configure protonvpn in kali linux download protonvpn from protonvpn official site https://protonvpn.com/sup...