Java upload files to remote linux server WITHOUT f

2019-08-27 18:43发布

问题:

I am trying to write a program in java to upload some files from my local environment to a remote server. I cannot use FTP because there is no FTP server installed on that instance. Also port 22 is closed so I can't use scp either.

Is there any other way to approach this?

Thanks in advance guys!

回答1:

You need something on the serverside, a program, which is waiting for your file. You can't just send something there.

An open port is always a program running, waiting for a connect.



回答2:

So a couple of possible protocols are rsync and WebDav. But at the end of the day I recommend one of two options. Get ssh installed, or use rsync.

Talk to the unix admin and work something out.



回答3:

Even linux servers sometimes use smb/cifs (the Microsoft technique to share files and folders) to publish data. The samba team provides a 100% Java library to access those: http://jcifs.samba.org/