1 / 6

How to Delete Write Protected File in Linux

Sometimes you may need to delete write protected file in Linux. Here are the steps to do it.<br><br>Visit https://fedingo.com/how-to-delete-write-protected-file-in-linux/

Download Presentation

How to Delete Write Protected File in Linux

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to Delete Write Protected File in Linux

  2. Check Permissions Only owners, superusers and root users are allows you to delete or modify write protected files & directories. So first view its permissions using ls -l command. $ ls -l filename -rwxrwxrwt ... In the above output, the last bit ‘t’ is the sticky bit and if its value is t only then it is write protected. Otherwise, anyone can delete it.

  3. Check Directory Permission Next, you need to have write access to the directory (its parent directory) that allows you to modify or delete this file or directory. $ ls -ld dirname If you don’t have enough privileges, you can switch to superuser and then remove the file. $ su - $ rm -f filename

  4. Check i attribute Finally, you need to check if the extended file system ‘i’ attribute is set or not, for this file. If your file or directory has this attribute set, then it cannot be modified, deleted, renamed or linked to. Only root users can add/remove this permission. You can use the lsattr command to check the value of this attribute. $ lsattr filename You will see the following type of output. ----i------------ filename

  5. Change i attribute You can use chattr -i command to remove the file’s ‘i’ attribute. But please note, only the root user will be able to run this command. Once you have removed the ‘i’ attribute for a file or directory, it can be deleted by other users also. $ chattr -i filename $ rm -f filename

  6. Thank You Visit for details https://fedingo.com/how-to-delete-write-protected-file-in-linux/

More Related