0

I have this weird directory in Oracle Linux that I cannot remove, cannot change owner, cannot change group, etc.

It seems to be an environment variable that is empty and is named: .$EXTEND

Here's what I've tried:

[root@PSFSTSTAPP01 interfaces]# ls -al
total 74
drwxrwxrwx  3 psoft psoft 3 May 11 12:42 .
drwxrwxrwx  4 psoft psoft 4 May 11 12:42 ..
drwx------+ 2 root  sys   3 Oct 23  2015 .$EXTEND
[root@PSFSTSTAPP01 interfaces]#

[root@PSFSTSTAPP01 interfaces]# chown root:root .$EXTEND
chown: changing ownership of `.': Operation not permitted
[root@PSFSTSTAPP01 interfaces]#

[root@PSFSTSTAPP01 interfaces]# echo $EXTEND

[root@PSFSTSTAPP01 interfaces]#

[root@PSFSTSTAPP01 interfaces]# echo .$EXTEND
.
[root@PSFSTSTAPP01 interfaces]#
[root@PSFSTSTAPP01 interfaces]# chmod 777 .$EXTEND
chmod: changing permissions of `.': Operation not permitted
[root@PSFSTSTAPP01 interfaces]#

[root@PSFSTSTAPP01 interfaces]# chattr -i .$EXTEND
chattr: Inappropriate ioctl for device while reading flags on .
[root@PSFSTSTAPP01 interfaces]#

[root@PSFSTSTAPP01 interfaces]# rm -r .$EXTEND
rm: cannot remove directory: `.'
[root@PSFSTSTAPP01 interfaces]# rmdir .$EXTEND
rmdir: failed to remove `.': Invalid argument
[root@PSFSTSTAPP01 interfaces]#
4

You can either escape the $ sign: rm -r .\$EXTEND
or
use single quotes: rm -r '.$EXTEND'

3

To differentiate a variable from a string bash uses $.

When you do :

rm -R .$EXTEND 

variable $EXTEND is expanded and the result is substituted.

Inorder to remove .$EXTEND file you need to tell bash to interpret $ without its special meaning. You can do it two ways :

rm -R .\$EXTEND #\ strips the special meaning of $

or

rm -R '.$EXTEND'
# Use single quotes. Variable expansion/substitution doesn't happen inside
# single quotes
  • I tried that syntax. Still no luck. – mgrep May 12 '16 at 18:06
  • [root@PSFSTSTAPP01 interfaces]# rm -R '.$EXTEND' rm: descend into directory .$EXTEND'? y rm: remove directory .$EXTEND'? y rm: cannot remove `.$EXTEND': Permission denied [root@PSFSTSTAPP01 interfaces]# ls -al total 74 drwxrwxrwx 3 psoft psoft 3 May 11 12:42 . drwxrwxrwx 4 psoft psoft 4 May 11 12:42 .. drwx------+ 2 root sys 3 Oct 23 2015 .$EXTEND [root@PSFSTSTAPP01 interfaces]# – mgrep May 12 '16 at 18:07
  • [root@PSFSTSTAPP01 interfaces]# rm -R '.$EXTEND' rm: descend into directory .$EXTEND'? y rm: remove directory .$EXTEND'? y rm: cannot remove `.$EXTEND': Permission denied [root@PSFSTSTAPP01 interfaces]# ls -al total 74 drwxrwxrwx 3 psoft psoft 3 May 11 12:42 . drwxrwxrwx 4 psoft psoft 4 May 11 12:42 .. drwx------+ 2 root sys 3 Oct 23 2015 .$EXTEND [root@PSFSTSTAPP01 interfaces]# – mgrep May 12 '16 at 18:07
  • Try applying the command as root. The previous command failed because if you are not root, you don't have any permissions on .$EXTEND – sjsam May 12 '16 at 18:17
  • if .$EXTEND is a directory, try removing it as root using the command su -c rm -R '.$EXTEND' – sjsam May 12 '16 at 18:19
0

I found out that the .$EXTEND directory is created on an Oracle ZFS storage system when SMB is enabled. SMB can be disabled for the pool but the .$EXTEND directory still cannot be removed.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.