How to delete permission denied files in Kali Linux
Could not delete lock files (Permission Denied)
This post was prepared for show you how to delete permission denied files in Kali Linux. The steps to solve this problem is same to all other Debian Distributions.
Why this error was occurred ?
This happens because you don’t own the directory or the directory is owned by root. So to delete it you can either change the ownership and then delete it otherwise get the superuser access.
SuperUser (or) RootUser:
In Linux, the superuser is a special user account used for system administration. Depending on Linux operating system, the actual name of this account might be root.
Only in root account you was able to make changes in default system packages.
What is SuperUser Permission (or) Grant Root Access:
In User Account you don’t have permission to make changes in system default packages. But you want to make changes, then every time you need to type SUDO SU for getting permission or root access. It was the annoying one for lot of users.
If you want to avoid to type SUDO SU every time. Then set up Grant Root Access in your user account. Follow the below steps for Grant Root Access.
- Locate that permission denied file
- Change the ownership
- Delete the file
Step 1: Locate that permission denied file
First of all, you need to change the ownership of the file which you want to delete. Open a terminal and switch the directory to where was the file located. In my case the file was located in Desktop directory. So the command is,
mk007@linuxlia:~$ cd Desktop
Now, it shows the files that are located in the directory.
Step 2: Change the ownership
Chown command is used for changing the ownership of the file.
mk007@linuxlia:~$ sudo chown -v 'username' 'filename'
Now the ownership of that file or directory was successfully changed.
Step 3: Delete the file
Right click that file, now you can see the delete option in the menu.
Alright, now that file was successfully deleted.
If you have any doubts about this post please leave a comment otherwise ping me in Instagram. Am ready to solve your doubts.