[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: permissions all zero when using 'cp'



On 12/29/2010 05:56 PM, Martin Lorenz wrote:
> Dear Gurus,
> 
> i recently noticed some errors at my mail-server and so I tried to drill
> it down with my limited abilities.
> 
> what I found is really strange:
> 
<-deleted->

> root@X:/tmp# ls -altr
> insgesamt 20
> drwxrwxrwt  2 root root  4096 29. Dez 15:06 .X11-unix
> drwxrwxrwt  2 root root  4096 29. Dez 15:06 .ICE-unix
> drwx------  2 mlo  users 4096 29. Dez 21:38 ssh-VkxmJ15962
> - - -rw-rw-r--  1 root root     0 29. Dez 21:47 test
> drwxr-xr-x 21 root root  4096 29. Dez 22:06 ..
> drwxrwxrwt  5 root root  4096 29. Dez 22:22 .
> 
> notice the file "test"
> 
> root@X:/tmp# cp test test.bak
> root@X:/tmp# cp -p test test.bak2
> root@X:/tmp# ls -altr
> insgesamt 36
> drwxrwxrwt  2 root root  4096 29. Dez 15:06 .X11-unix
> drwxrwxrwt  2 root root  4096 29. Dez 15:06 .ICE-unix
> drwx------  2 mlo  users 4096 29. Dez 21:38 ssh-VkxmJ15962
> - - -rw-rw-r--  1 root root     0 29. Dez 21:47 test.bak2
> - - -rw-rw-r--  1 root root     0 29. Dez 21:47 test
  ^^^^
> drwxr-xr-x 21 root root  4096 29. Dez 22:06 ..
> - - ----------  1 root root     0 29. Dez 22:22 test.bak
> drwxrwxrwt  5 root root  4096 29. Dez 22:22 .
> 
> now kindly notice test.bak and test.bak2
<-deleted->

I'm not sure if this is relevant, but the ls output lines for these
files look odd, having "extra" '- ' characters at the start.

Older 'ls' commands (not Gnu) might do this, if the file name contained
a literal carriage return character, but the 'ls' on my system prints a
question mark for non-printing/graphic characters.

You could try the '-b' option and see what that prints.  The Gnu ls uses
backslash escapes (\r, \b, \octnum etc.).  This might help in searching
strace output, if you do try Bob Proulx's suggestion, since you would
know the actual character to look for.

Also, you ran the above as root.  Since the original file is readable by
all, what happens if you do the copy as a regular user?

-- 
Bob McGowan


Reply to: