Deleting a file owned by root

Recently, a friend played a prank on my pc and now I have a file sitting on my desktop called 'hardcore_porn_xxx'. The problem is it does not go away by a simple delete. I'm new to linux so any help will be appreciated. Thanks

By the way, could this be related to file permissions or something?

hmm@hmmm~$ ls -l
total 0
-rw-r--r-- 1 root root 0 2012-06-04 21:01 hardcore_porn_xxx
3

3 Answers

It does not matter what permissions are on that file. You need to have write permissions on the directory that contains the file.

(You can even remove files not owned by you if you have write permission for the directory. A confirmation question will appear and by answering with yes, the file will go away.)

So while impersonating the root user will remove the file, you could do that by your own if you could write to the file's parent directory.

Could you list the permissions + owner for that?

On the reappearing problem:

Please execute sudo crontab -l to see if there are any cron jobs for root, and include the output in your question.

Update 2

Your response was:

found this: * * * * * touch /home/chimp/Desktop/hardcore_porn_xxx

Your output states it is a cron job.

Now please execute sudo crontab -e, pick your editor (e.g. mcedit) and delete the whole line containing touch.... Exit the editor, remove the file with any method and wait. It should not reappear anymore.

3

The file is owned by root. You have to delete it with root privileges

sudo rm hardcore_porn_xxx

It won't delete because its owned by 'root' aka superuser.

Delete the file as superuser, and your problem is solved:

sudo rm -f [file]

replace [file] with the path to the file though.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like