6

I had used file-roller to extract an ISO image to my Desktop earlier, but now I can not delete or move/rename those files any more "as myself", only with sudo. Changing permissions (chmod) or content is possible though.

bytecommander@BC-AlkaliMetal:~/Desktop$ ll AUTORUN.INF 
-rwxr-xr-x 1 bytecommander bytecommander 132 Jul 21  2005 AUTORUN.INF*

bytecommander@BC-AlkaliMetal:~/Desktop$ chmod 777 AUTORUN.INF 

bytecommander@BC-AlkaliMetal:~/Desktop$ echo "Something useless" > AUTORUN.INF

bytecommander@BC-AlkaliMetal:~/Desktop$ cat AUTORUN.INF 
Something useless

bytecommander@BC-AlkaliMetal:~/Desktop$ ll AUTORUN.INF 
-rwxrwxrwx 1 bytecommander bytecommander 18 Sep 22 21:13 AUTORUN.INF*

bytecommander@BC-AlkaliMetal:~/Desktop$ rm AUTORUN.INF 
rm: cannot remove 'AUTORUN.INF': Permission denied

However, I would like to understand what exactly is holding me back here though.

My Desktop directory is on an ext4 partition. Output from mount:

/dev/sdb5 on / type ext4 (rw,noatime,nodiratime,errors=remount-ro,data=ordered)

I could not find any suspicious permissions, ACLs, extended attributes or anything else I know of though:

bytecommander@BC-AlkaliMetal:~/Desktop$ stat AUTORUN.INF 
  File: 'AUTORUN.INF'
  Size: 18          Blocks: 8          IO Block: 4096   regular file
Device: 815h/2069d  Inode: 405817      Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/bytecommander)   Gid: ( 1000/bytecommander)
Access: 2016-09-22 18:18:36.569110000 +0200
Modify: 2016-09-22 21:13:26.821382722 +0200
Change: 2016-09-22 21:26:16.653296674 +0200
 Birth: -

bytecommander@BC-AlkaliMetal:~/Desktop$ getfacl AUTORUN.INF 
# file: AUTORUN.INF
# owner: bytecommander
# group: bytecommander
user::rwx
group::rwx
other::rwx

bytecommander@BC-AlkaliMetal:~/Desktop$ lsattr AUTORUN.INF 
-------------e-- AUTORUN.INF

What is going on here?

3
  • 6
    removing a file requires write permission in its parent directory - did you check that? Sep 22, 2016 at 19:35
  • @steeldriver Facepalm! Actually somehow that bit got removed on my Desktop. That was it. Too simple. Would you post it as answer?
    – Byte Commander
    Sep 22, 2016 at 19:39
  • @ByteCommander OK done Sep 22, 2016 at 19:47

1 Answer 1

11

Removing a file requires write permission in its parent directory - so may fail if either

  • ~/Desktop/ has has incorrect permission bits
  • ~/Desktop/ has correct permissions but has become owned by someone else such as root

Check and adjust as necessary.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .