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

Kali linux terminal commands - app install & uninstall

Kali Linux -  app install & uninstall

sudo apt-get upgrade               linux pakage info upgrade
sudo apt-get dist-upgrade        linux pakage info upgrade

suod apt-get update                       linux pakage info update
sudo apt-get install libreoffice         install libreoffice   
sudo apt-get install gimp                install gimp    

sudo apt --purge remove gimp 
       command is used to uninstall gimp and deletes all the        

                                                        configuaration files

sudo apt remove gimp            onlye install gimp will retain all the config files

suod apt -autoremove            when you uninstall a program, there may be packages that the    

                                               uninstalled program depended upon that no longer used
                                               to remove any unused packages, use the autoremove command
                    
suod apt purge --autoremove gimp    this command removing a program and removing 

                                                           dependencies that are no longer being used into one

sudo apt clear                 to remove downloaded archive files

dpkg --list                used to see a list of all installed packages on your computer


dpkg-query -l gimp            installed application status with version details for gimp application
dpkg-query -l libreoffice        installed application status with version details for libreoffice application


Kali Linux - Change SSH keys

Kali Linux - SSH Key generation and setup

All ssh keys are located in  /etc/ssh folder 

Replace new ssh key(file) for all existing key/file as ssh_host

create new folder

  • $mkdir old_keys

move existing key/files to old_keys folder

  • $mv ssh_host* /etc/ssh/old_keys

generate new keys

  • $sudo dpkg-reconfigure openssh-server

to check/compact old and new values

  • $md5sum ssh_host*
  • $md5sum oldkeys/ssh_host*

 


Kali linux - Root Password setup

Kali Linux - Root Password setup

 Step1

  • open Terminal window

 Step2

  • $ sudo su
  • $passwd root
          enter new password

 Step3

to change any user password

  • $passwd username

          enter new password

 


Kali linux USB Stick [live]

 Step1

 Step2

 Step3

  • select appropriate iso 
  • setup persistence size 60% if usb capacity >=32GB
  • select FAT32, 16kb cluster size
  • then run installation

Step4

  • once done, shutdown PC restart with USB booting; it will load kali linux live

 

Kali linux - protonvpn setup

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