Ved International Discussion Board


Join the forum, it's quick and easy

Ved International Discussion Board
Ved International Discussion Board
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How to delete a write protected file

4 posters

Go down

How to delete a write protected file Empty How to delete a write protected file

Post by bindaas7 Sun Aug 05, 2012 3:52 pm


How to delete a write protected file

"How to delete write protected file under Linux..."

Under Linux (and other Unixsh oses) following criteria should matched before deleting a file:
Criteria # 1

To delete or remove a file you need to be owner of a file. Use ls -l command to verify your ownership:
$ ls -l filename

If you have sufficient rights, you can remove a file. Otherwise, become a superuser to remove a file.
Criteria # 2

In addition, you must have a write access to on a directory that allows you to remove or add new files. Again us ls -l or ls -ld command to get write ownership of directory.
$ ls -ld dirname

If you have sufficient rights, you can remove a file. Otherwise, become a superuser to remove a file. Use chown / chmod commands to setup permission OR run rm command as root user:
# su -
# rm -f file.txt
Criteria # 3

Make sure file is not protected using extended file system 'i' attribute. A file with the 'i' attribute cannot be modified, it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only root can add or remove 'i' attribute. Use lsatter command to verify that file is not write protected using extended 'i' attribute:
$ lsattr file.txt

Output:

----i------------ file.txt

Above output indicates that file.txt has i attribute set on it. Become a superuser and follow the instruction mentioned here to remove a write protected file:
# chattr -i file.txt
# rm -f file.txt

hope this will help you out...

bindaas7
Newbies
Newbies

Posts : 21
Join date : 2012-07-27
Age : 31

Back to top Go down

How to delete a write protected file Empty Re: How to delete a write protected file

Post by HipHopper Fri Aug 10, 2012 7:03 am

Actually i was surfing the net to solve my same problem, and here it is, the solution!! thanks a lot to you as well as this forum!! keep posting more!!
HipHopper
HipHopper
Moderator
Moderator

Posts : 42099
Join date : 2011-07-30
Location : Kathmandu, Nepal

http://khabarful.blogspot.com/

Back to top Go down

How to delete a write protected file Empty Re: How to delete a write protected file

Post by swikritipradhan Fri Aug 10, 2012 2:58 pm

Oh yes you have solve the main problem of mine and this technique has helped me lot. I like the concept very much. Thank you for sharing this post and solving my problem.

swikritipradhan
Eligible
Eligible

Posts : 1110
Join date : 2012-07-31
Age : 30
Location : patan sundhara

Back to top Go down

How to delete a write protected file Empty Re: How to delete a write protected file

Post by sujin007 Fri Oct 05, 2012 10:05 am

Well this is a new topic for me. I think I must give it a try. I didn't know about that. Well thank you so much for sharing that thread with us in this forum.
sujin007
sujin007
Eligible
Eligible

Posts : 11545
Join date : 2012-07-06
Age : 30
Location : Putalisadak, Kahmandu

Back to top Go down

How to delete a write protected file Empty Re: How to delete a write protected file

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum