1

From my windows machine I would like to scp (I have git bash installed) 2 files to a directory on a redhat box.

In the directory where the 2 files are I do in my terminal

user@workstation$ scp file1.jar user@remote:/home/user/dir/ FAILS: permission denied
user@workstation$ scp file2.jar user@remote:/home/user/dir/ WORKS

Surprisingly, both files (locally) have the same permissions (ls -al)

-rw-r--r--    1 user   admin 58706904 Jun  4 16:02 file1.jar
-rw-r--r--    1 user   admin 45033480 Jun  4 16:02 file2.jar

On the remote server I gave the target directory dir full permissions to everyone (chmod 777)

drwxrwxrwx  3 user root       4096 Jun  4 16:16 .

Neither on the windows nor on the redhat machine I have admin access.

Thanks for the help

  • What are the permissions of the remote version of file1.jar? – Jeff Schaller Jun 4 '18 at 15:49
  • remote version of file1.jar? I have file1.jar locally – tenticon Jun 4 '18 at 15:51
  • Is there a remote one that’s not letting you overwrite it? – Jeff Schaller Jun 4 '18 at 15:52
  • no I deleted file1.jar on remote (it used to work) – tenticon Jun 4 '18 at 15:53
0

Instead of copying the two files file1.jar, file2.jar from the directory where they were created (by packaging a maven project using mvn clean package in the java project folder) to a separate folder before sending them with scp to the remote server, I sent them from the original directory directly and that worked.

So copying the files must have done something to the permissions of one of the files but not to the other. Really strange. But anyways, it works now..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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