Duplicate directory in same partition help.

Hi,

I have found a directory on my web server that have 2 same directory names in the same location on the same partition. Is there a way to mkdir a name twice and be able to see them both in the same location?

Heres an example of the ouput:

[root]# ls
access_log.1.bkup       access_log.1.bkup.2.gz  data         public_html 
access_log.1.bkup.1.gz  access_log.1.bkup.3.gz  public_html

Unix forbids the same file name under the same directory. How could this be possible?

As you can see there are two public_html directories and they both have two different inode numbers but when you cd into public_html which one would you end up in?
Is there some way to know which one is the suspicious one? I would like to delete the suspicious public_htm. I believe an unauthorized access has created this duplicate and doing something malicious.

I have use the command find . -inum 293843 | xargs cd to try to change directory to the one I thought was suspicious but I get an error message saying directory doesn't exist. And the same error message for the other directories by trying to CD into a directory by specifying the inode instead of the file name.

Any help and ideas would be appreciated!

I need to cd into a directory by specifying the inode number and not the file name.
I would aslo like to know the possibility of creating two same name folders under same directory.

Best Regards,[COLOR="\#738fbf"]

Hi.

Can you show the result of an ls -ld * command?

Check the output of 'ls -lb'. Any non-printing characters should show up escaped, in case the second directory has them.

If that doesn't help try running an fsck on the mount in question.

Yes, thanks! (I always type ls -ld out of habit)

This is the output of ls -d *

drwxrwxr-t  34 root       sappy  4096 1010 16:17 public_html
drwxrwxrwx   2 sappy www         4096  526 11:37 public_html 

This is the output of ls -ld

drwxr-x---  5 sappy www 4096 Oct 22 00:55 .

Before I delete the suspicious one by specifying the inode with the find command I wanted to CD into it to see if there is anything interesting. But I can not find a way to CD into a directory by specifying just the inode instead of the filename.

Has anyone ever experienced having two same directory in the same location before?

First, please use code tags for listings, command lines, ...

Second, please post the output of 'ls -lb'

Pludi,

Sorry about not using code tags.

I was able to list the contents of the directory with:

 find . -inum "inode#"  -exec ll -b {} \;

I guess that will do but I initially was looking for a way CD into directory specifying inode number.

For example:

[root]# find . -inum 987231 | xargs cd
xargs: cd: No such file or directory

or

[root]# find . -inum 987231 -exec cd {} \;
find: cd: No such file or directory

Thanks.

What I meant was asking you to post the output of the command 'ls -lb', without any find or xargs, issued from the directory where these "duplicate" directories reside. Because if it's not a filesystem problem, but just a naming problem (because of non-printing special characters) that's the easiest way to detect them.

Oh yes you are right about the hidden character. Here is the output of the command by the way:

[root]# ls -lb

drwxrwxr-t  34 root       sappy 4096 Oct 10 16:17 public_html
drwxrwxrwx   2 sappy www         4096 May 26 11:37 public_html\ 

There is "\" on the end of one of them.

Regards,

Then it's probably just an appended space. Try

cd "public_html "

You can check this by running 'ls -lbQ', which will additionally quote the entry, to see how many spaces are appended.

---------- Post updated at 15:29 ---------- Previous update was at 15:25 ----------

Example output for future reference:

-rw-r--r-- 1 pludi users 0 22. Okt 15:27 test.file     # regular file
-rw-r--r-- 1 pludi users 0 22. Okt 15:27 test.file\    # with 1 space appended
-rw-r--r-- 1 pludi users 0 22. Okt 15:27 test.file\ \  # with 2 spaces appended
-rw-r--r-- 1 pludi users 0 22. Okt 15:27 test.file\377 # with ASCII char 255 (0xFF) appended
-rw-r--r-- 1 pludi users 0 22. Okt 15:27 test.file\t   # with tab appended
-rw-r--r-- 1 pludi users 0 22. Okt 15:27 test.file\r   # with carriage return appended

Pludi,

Thank you for your support! That did the trick, I was able to cd into the directory.
But still curious of it its impossible to cd by specifying inode.

Thank for your help,

Best Regards,