Quantcast

Error with pscp on Windows: "Cannot create file"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Error with pscp on Windows: "Cannot create file"

Peter Goetz
Hi there,

I'm trying for some time now to get Maven to work with a Repository accessed by SSH / SCP. I work with a Windows box and have the putty programs (putty, plink, pscp, ...) installed and ready in the PATH. I have added the following <server> configuration to my settings.xml:
    <server>
      <id>[REPOSITORY_INFO]</id>
      <username>[USER_NAME]</username>
      <configuration>
        <scpExecutable>pscp</scpExecutable>
        <scpArgs>-v</scpArgs>
      </configuration>
    </server>
I have pageant running and managing my private key to access the repository. When I run "mvn package" and the dependencies should be got, I see the following in my console:
[WARNING] repository metadata for: '<ARTIFACT>' could not be retrieved from repository: <REPOSITORY> due to an error: Exit code: 1 - Looking up host "<HOST>"
Connecting to <IP> port 22
Server version: SSH-2.0-OpenSSH_4.4
We claim version: SSH-2.0-PuTTY_Release_0.60
Using SSH protocol version 2
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-256
Host key fingerprint is:
ssh-rsa 1024 a2:fb:2b:a3:dc:ff:d5:fd:79:7c:a2:58:8f:92:5d:dc
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
Reading private key file "C:\Dokumente und Einstellungen\<USER>\.ssh\id_rsa"
Unable to use this key file (OpenSSH SSH-2 private key)
Unable to use key file "C:\Dokumente und Einstellungen\<USER>\.ssh\id_rsa" (OpenSSH SSH-2 private key)
Pageant is running. Requesting keys.
Pageant has 1 SSH-2 keys
Using username "<USER_NAME>".
Trying Pageant key #0
Authenticating with public key "<KEY_COMMENT>" from agent
Sending Pageant's response
Access granted
Opened channel for session
Started a shell/command
Using SFTP
Connected to <HOST>

scp: maven-metadata-<REPOSITORY_INFO>.xml.tmp: Cannot create file

Sent EOF message
Server sent command exit status 0
Disconnected: All channels closed

I have masked everything in the above log output that makes it possible to know who I am working with. I am an external consultant and don't want to break my contract. :)

It seems to me, that I am successfully accessing the repository (btw. I get some of the other files I need, so I think it works in principle), but that I have an error writing the file to my local disk. I have tried to do this with pscp on the console, and it works just fine.

Can you tell me how I can make Wagon print me the concrete statement that it used to copy the file? Or do you perhaps already know what error I'm running into?

Thank you very much for your help!

Cheers,

Peter
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error with pscp on Windows: "Cannot create file"

jhjessup
I encountered the same problem this morning.

I was trying to copy the contents of a remote directory to a local directory with pscp.exe, with all the options specified on the command line (i.e., username, keyfile, etc). The command executed successfully if I entered it directly, but it would give an error when it executed as part of a script:

scp: <file path>: Cannot create file

I fixed the problem by appending "." (dot) to the destination directory path.

Original command line:
pscp.exe <options> "remote.server:/source/file/path/*" "c:\local\file\path\"

Corrected command line:
pscp.exe <options> "remote.server:/source/file/path/*" "c:\local\file\path\."

- Jonathan

Peter Goetz wrote
Hi there,

I'm trying for some time now to get Maven to work with a Repository accessed by SSH / SCP. I work with a Windows box and have the putty programs (putty, plink, pscp, ...) installed and ready in the PATH. I have added the following <server> configuration to my settings.xml:
    <server>
      <id>[REPOSITORY_INFO]</id>
      <username>[USER_NAME]</username>
      <configuration>
        <scpExecutable>pscp</scpExecutable>
        <scpArgs>-v</scpArgs>
      </configuration>
    </server>
I have pageant running and managing my private key to access the repository. When I run "mvn package" and the dependencies should be got, I see the following in my console:
[WARNING] repository metadata for: '<ARTIFACT>' could not be retrieved from repository: <REPOSITORY> due to an error: Exit code: 1 - Looking up host "<HOST>"
Connecting to <IP> port 22
Server version: SSH-2.0-OpenSSH_4.4
We claim version: SSH-2.0-PuTTY_Release_0.60
Using SSH protocol version 2
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-256
Host key fingerprint is:
ssh-rsa 1024 a2:fb:2b:a3:dc:ff:d5:fd:79:7c:a2:58:8f:92:5d:dc
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
Reading private key file "C:\Dokumente und Einstellungen\<USER>\.ssh\id_rsa"
Unable to use this key file (OpenSSH SSH-2 private key)
Unable to use key file "C:\Dokumente und Einstellungen\<USER>\.ssh\id_rsa" (OpenSSH SSH-2 private key)
Pageant is running. Requesting keys.
Pageant has 1 SSH-2 keys
Using username "<USER_NAME>".
Trying Pageant key #0
Authenticating with public key "<KEY_COMMENT>" from agent
Sending Pageant's response
Access granted
Opened channel for session
Started a shell/command
Using SFTP
Connected to <HOST>

scp: maven-metadata-<REPOSITORY_INFO>.xml.tmp: Cannot create file

Sent EOF message
Server sent command exit status 0
Disconnected: All channels closed

I have masked everything in the above log output that makes it possible to know who I am working with. I am an external consultant and don't want to break my contract. :)

It seems to me, that I am successfully accessing the repository (btw. I get some of the other files I need, so I think it works in principle), but that I have an error writing the file to my local disk. I have tried to do this with pscp on the console, and it works just fine.

Can you tell me how I can make Wagon print me the concrete statement that it used to copy the file? Or do you perhaps already know what error I'm running into?

Thank you very much for your help!

Cheers,

Peter
Loading...