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.

sunilbainsAsked:
Who is Participating?
 
xtermCommented:
If you chmod 777 /home/nyistpp/stmtpim/wmr/abc.txt, then yes, you will be able to overwrite it, but it's new permissions will now become exactly what the permissions are of /home/njifcip/stmtpim/wmr/abc.txt.

Course you will have to be root to do that, and if you're going to do that, you might as well just rm  /home/nyistpp/stmtpim/wmr/abc.txt and get it out of the way.
0
 
woolmilkporcCommented:
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
0
 
sunilbainsAuthor Commented:
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?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
woolmilkporcCommented:
Right.

What do you get with

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

and

id

?
0
 
sunilbainsAuthor Commented:
$ 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)
0
 
omarfaridCommented:
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
0
 
xtermCommented:
/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.
0
 
sunilbainsAuthor Commented:
Hello xterm,
what is the alternative solution?
 should we have 777 permission on tgt-- /home/nyistpp/stmt/data/wmr/ existing files.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.