No need to confirm fingerprint, no need to type password in keyboard, just put password as command-line argument to scp, suit for using in scripts.
Written in Java, Run under both Windows and Linux.
The recursive (-r) option is not supported yet.
- Install Java 11 or above.
- Download, unzip from the Releases page.
- Run in command prompt, arguments are same as the standard ssh command, plus --password option, like
scp-password --password OpenSesame c:\hello.txt alibaba@192.168.0.1:/tmp
Specify connection timeout in seconds:
scp-password -o ConnectTimeout=10 --password OpenSesame c:\hello.txt alibaba@192.168.0.1:/tmp
or using a new option name to keep the style:
scp-password --connect-timeout 10 --password OpenSesame c:\hello.txt alibaba@192.168.0.1:/tmp
Get full command-line usage:
scp-password --help
-
In Maven pom.xml:
See Packages page. -
In Java code:
import cn.nhcqc.sshex.Scp;
var config = new Scp.Config ();
// set config field values
new Scp ().run (config);
LGPL-2.1 (GNU Lesser General Public License).
See file LICENSE for details.
- Install Apache Maven 3
- Run
mvn package
- In the target folder, those listed below are for standalone run:
- *.bat
- *.java
- *.ini
- lib
(Dependencies)
examples
https://github.com/hierynomus/sshj/tree/master/examples/src/main/java/net/schmizz/sshj/examples
com.hierynomus:sshj:0.33.0
https://search.maven.org/artifact/com.hierynomus/sshj
<dependency>
<groupId>com.hierynomus</groupId>
<artifactId>sshj</artifactId>
<version>0.33.0</version>
</dependency>
Using
https://commons.apache.org/proper/commons-cli/usage.html
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.5.0</version>
</dependency>
user manual
https://www.slf4j.org/manual.html
config file
http://www.javapractices.com/topic/TopicAction.do?Id=143