Link to home
Start Free TrialLog in
Avatar of sunilbains
sunilbains

asked on

cp-issue in unix

When i try
cp /home/njifcip/stmtpim/wmr/* /home/nyistpp/stmt/data/wmr/
cp: cannot create regular file `/home/nyistpp/stmt/data/wmr/abc.txt': Permission denied

Why i am getting this error.
Both path have wmr directory full permission.
I created test dir under wmr and could perform successful copy
Please advise.

Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Could it be that the source of "abc.txt" is a symbolic link pointing to a file you don't have read permission to?

Check with

ls -l /home/njifcip/stmtpim/wmr/abc.txt

If it's indeed a link use the "-P" flag to copy links as links, if appropriate.

wmp
Avatar of sunilbains
sunilbains

ASKER

i tried ls -l /home/njifcip/stmtpim/wmr/abc.txt

and getting following output
-rw-r--r--    1 njifcip  pcs-tech--1   717336 Oct 22 02:09 /home/njifcip/stmtpim/wmr/abc.txt
Does not seem to be link?
Right.

What do you get with

ls -ld /home/nyistpp/stmt/data/wmr

and

id

?
$ ls -ld /home/nyistpp/stmt/data/wmr
drwxrwxrwx    5 nyistpp  games        4096 Oct 26 12:34 /home/nyistpp/stmt/data/wmr
wmr]$ id
uid=72619(nyoteapb) gid=20(games) groups=20(games)
the dir is owned by other user nyistpp  and file abc.txt is owned by other user njifcip and you have read only on that file
/home/njifcip/stmtpim/wmr/abc.txt already exists and is owned by another user, so you cannot overwrite it, however you are still permitted to create new files or directories because /home/njifcip/stmtpim/wmr is world-writable.  This is exactly how the system should act.
Hello xterm,
what is the alternative solution?
 should we have 777 permission on tgt-- /home/nyistpp/stmt/data/wmr/ existing files.
ASKER CERTIFIED SOLUTION
Avatar of xterm
xterm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial