23

I am facing a tricky situation here. I have a java based application that tries to scp remote machines to copy certain files. While performing those tasks , I am finding the below error message from the application side.

scp protocol error mtime.sec not present

But when I manually try to scp from the server to endpoint machine, I am able to do it without issues.

The command I am using for manual testing is scp localfile user@hostname:/tmp/

I am not sure of the error message mtime.sec is not present . Does anyone can throw some lights here. I couldn't find useful info from web, Any experts thoughts would help a lot.

As SCP is working normally using manual process, I am not sure there is something wrong with SCP.

jww
  • 97,681
  • 90
  • 411
  • 885
skanagasabap
  • 910
  • 3
  • 12
  • 24
  • 1
    I used `-vvvv` to find out. The real problem was `Too many logins`. The server accepted only two logins at a time. – toliveira Jul 28 '20 at 15:25

4 Answers4

38

I've got the same issue. It worked for me if I scp to ubuntu 12.04. When I did that to ubuntu 14.04, it failed with same message.

I wrote the scp code based on this example http://www.jcraft.com/jsch/examples/ScpTo.java.html. I guess you too.

If I remove the whitespace after the "T" in the following line, it'll work. Change:

command="T "+(_lfile...

to

command="T"+(_lfile...

Either do that or set ptimestamp = false

Roger Dueck
  • 615
  • 7
  • 16
Bao Ho
  • 617
  • 8
  • 10
  • Yes , I agree... I too had to update the command and it worked , I missed to update the question here.. thanks for your input – skanagasabap May 12 '14 at 06:54
  • Yep, exactly same issue here with that example... Thank you for the solution! I'll try to notify the authors of that example somehow. – DragonGamer Sep 28 '17 at 03:43
  • how do i `set ptimestamp = false`, please? Tks in advance. – tony gil May 26 '18 at 11:56
  • inside file [ScpTo.java](http://www.jcraft.com/jsch/examples/ScpTo.java.html), around line 40, you will see how to use that flag – Bao Ho May 27 '18 at 03:03
9

Like ZZapper above writes.

I ran into the same issue as above, trying to use scp to connect to a remote site and it also told me "protocol error: mtime.sec not delimited "

Running scp with -vvvv it turned out on the 'server side' they disallowed me to use scp and told me to use sftp instead.

Jérémie B
  • 10,611
  • 1
  • 26
  • 43
Riccardo
  • 91
  • 1
  • 2
3

I learned my issue derived from the fact that our stftp server solely allows sftp connections. scp is not allowed.

debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
Sink: This service allows sftp connections only.
protocol error: mtime.sec not present
T. Matre
  • 31
  • 1
2
protocol error: mtime.sec not delimited  

I Googled this and learnt that this is a convoluted error message. We recently disabled our root login by making it 'nologin'. I forgot to update my scp script which was still trying to login as root. When I updated it use the new login all was fine. (sorry nothing to do with Java)

zzapper
  • 4,743
  • 5
  • 48
  • 45