Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

So here's code for sending or receiving a file through SCP (SSH secure copy) with ScriptMaster.

Requires the Orion SSH-2 java library from http://sourceforge.net/apps/mediawiki/orion-ssh2/index.php .

They can be easily adapted to use put/get methods that will get or put multiple files at once. Comments and suggestions always welcome.

 

 

SCPGet ( hostname ; privateKey ; username ; localTargetDirectory ; remoteFile )

import java.io.IOException;

import com.trilead.ssh2.Connection;
import com.trilead.ssh2.SCPClient;

try {

// Convert private key to character array
char[] privateKeyArray = privateKey.toCharArray();

// Create and open connection
Connection theConnection = new Connection(hostname);
theConnection.connect();

// Authenticate with public (private really) key
boolean isSuccess = theConnection.authenticateWithPublicKey(username, privateKeyArray, null);
if (isSuccess == false)
throw new RuntimeException( "ERROR: Authentication error" );

// Create SCP client and get remote file to local target directory
SCPClient theClient = new SCPClient (theConnection);
theClient.get(remoteFile, localTargetDirectory);

// Close the connection 
theConnection.close();   

return;
}
catch (IOException e) {
throw new RuntimeException( e );
}

SCPPut ( privateKey ; hostname ; username ; remoteTargetDirectory ; localFile )

import java.io.IOException;

import com.trilead.ssh2.Connection;
import com.trilead.ssh2.SCPClient;

try {

// Convert private key to character array
char[] privateKeyArray = privateKey.toCharArray();

// Create and open connection
Connection theConnection = new Connection(hostname);
theConnection.connect();

// Authenticate with public (private really) key
boolean isSuccess = theConnection.authenticateWithPublicKey(username, privateKeyArray, null);
if (isSuccess == false)
throw new RuntimeException( "ERROR: Authentication error" );

// Create SCP client and put local file to remote target directory with mode 600
SCPClient theClient = new SCPClient (theConnection);
theClient.put(localFile, remoteTargetDirectory);

// Close the connection 
theConnection.close();   

return;
}
catch (IOException e) {
throw new RuntimeException( e );
}

Code on,

JP

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.