Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This is in a continuation of question here

I run this command as root user

chown someuser:someuser /mnt/my-address

and then

# ls -l /mnt/my-address

response is

total 16
drwx------ 2 root root 16384 Aug 16 11:04 lost+found

but when i do

stat /mnt/my-address

and response is

File: `/mnt/my-address'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: ca51h/51793d    Inode: 2           Links: 3
Access: (0755/drwxr-xr-x)  Uid: (  106/ someuser)   Gid: (  112/ someuser)
Access: 2012-08-16 13:59:53.261099055 +0000
Modify: 2012-08-16 11:04:45.000000000 +0000
Change: 2012-08-16 13:59:44.013099226 +0000
 Birth: -

Why I am getting difference user and group with different commands?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

ls -l /mnt/my-address is showing you the files/directories inside my-address. These are only affected if you use the chown -R command to change ownership (R)ecursively. All you did was change the ownership of /mnt/my-address, not any of its contents.

stat /mnt/my-address gives you information on the actual directory/mountpoint /mnt/my-address though, whose ownership you did change. That's why the two are different.

share|improve this answer
    
+1, recursively means all the files and directory inside of /mnt/my-address –  Gaurav Agarwal Aug 16 '12 at 14:47
    
Thanks, I wrote the answer on my phone, edited to clarify. –  izx Aug 16 '12 at 15:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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