-3

Tried with a few things I could think of without success. Ideas? Thanks.

Yvonne
  • 153
  • 1
  • 1
  • 3

4 Answers4

3

You should be able to delete the file if you run the remove command with sudo

sudo rm /path/to/file.txt
Andreas Gassmann
  • 6,334
  • 7
  • 32
  • 45
0

If it's your server, you can just sudo rm file.

mjuarez
  • 16,372
  • 11
  • 56
  • 73
  • Please do **not** do -rf in this situation. It will not help you and it could be a disaster. – DWright Apr 16 '15 at 03:34
  • The reason it could be a disaster is that if the file is a linke to a folder structure and you aren't aware of it, it will do a recursive delete. You don't want to do `-rf` unless you explicitly want to recursively delete something. – DWright Apr 16 '15 at 04:17
0

thanks to everyone. The answer is when all attempts to change owner of the file fail, check the owner of its parent directory :).

Yvonne
  • 153
  • 1
  • 1
  • 3
-2

rm -rf filename if you have the permission do delete the file

Otherwise:

sudo chown user filename && rm -rf filename where user is your username.

Amin Shah Gilani
  • 8,675
  • 5
  • 37
  • 79
  • Please do not do -rf in this situation. It will not help you and it could be a disaster. – DWright Apr 16 '15 at 04:12
  • The reason it could be a disaster is that if the file is a linke to a folder structure and you aren't aware of it, it will do a recursive delete. You don't want to do `-rf` unless you explicitly want to recursively delete something. – DWright Apr 16 '15 at 04:17