This question was also asked here.
When I copy some directory (dir) recursively with sudo in bash it copies just the first level of the dir hierarchy, but when used without sudo it copies the dir with all its subdirs, though commands in command-line have the difference only in the presence of sudo.
Why does this happen?
For example:
k@l:/$ tree
.
|
|__a
| |
| |__b
| |
| |__1.htm
|
|__c
k@l:/$ sudo cp -r /a/b /c/d
k@l:/$ cd /c
k@l:/c$ ls
d
k@l:/c$ cd d
bash: cd: /c/d: Permission denied
k@l:/c$ tree
.
|__d [error opening dir]
1 directory, 0 files