Search the Community

Showing results for tags 'ssh'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Custom Function Library

Categories

  • Journal

Community Forums

  • Community Resources
    • FileMaker Pro 16 Discussions
    • FileMaker Pro 15 Discussions
    • Community Articles, Tips, & Techniques
    • FileMaker Marketplace Discussions
  • FileMaker Security Management
    • Security Concepts
    • Intellectual Property
  • FileMaker Server Administration
    • FileMaker Server 16
    • FileMaker Server 15
    • FileMaker Custom SSL Certificates
    • External Server Authentication
    • Stand by Server Deployment
    • Legacy FileMaker Server Discussions
  • FileMaker Platform
    • FileMaker Interface Features
    • FileMaker Schema & Logical Functions
    • FileMaker Go for iPhone & iPad
    • iBeacon Support
    • FileMaker IOS App SDK
    • FileMaker Discussions
    • Brain Food
  • FileMaker and the Internet
    • FileMaker Cloud
    • FileMaker WebDirect
    • Custom Web Publishing
    • Other Internet Technologies
  • Geist Interactive Product Support Forums
    • Visit Geist Interactive
    • Visit Modular FileMaker
    • FMPerception
    • Generator
    • fmQBO
  • 360 Works Official Product Support Forums
    • 360 Works General Support
    • MirrorSync by 360Works
    • SuperContainer by 360 Works
    • ScriptMaster by 360 Works
    • FTPeek by 360 Works
    • 360Works Email Plugin
    • DocuBin by 360 Works
    • Zulu – FileMaker, iCal & Google Calendar.
  • FM Forums Affiliate Sponsors
    • SyncServer Pro by LinearBlue
    • Open Source Frameworks
    • Monkey Bread Software (MBS Plugin)
    • FileMaker Plug-Ins
    • ISO FileMaker Magazine
    • User Group Central - Sponsored by FMPug.com
  • FM Starting Point - By Richard Carlton Consulting
    • Visit FM Starting Point
    • FM Starting Point - General Discussions
  • FileMaker Classifieds
    • FileMaker Product & Service Announcements
    • Professional FileMaker Training
    • Services for Hire
    • Services Wanted
    • Solutions Wanted
    • Tools Of The Trade
  • The Water Cooler
    • Member Lounge
    • Wants & Wishes
  • FM Forums Operations
    • FM Forums Feedback & Site News
    • Site Instructions

Blogs

  • Captain's Blog
  • FileMaker Weetbicks
  • FileMaker Security Blog
  • The FileMaker Rift
  • HOnza's Bits @ FMForums
  • SeedCode
  • CampSoftware, Hal Gumbert
  • FileMaker Hacks
  • Skeleton Key's Blog
  • Wing Forward Solutions
  • 360Works Articles and Tutorials
  • GoBillit
  • Filemaker - an amateur's view
  • Linear Blue
  • Surya Kanta Mekap's Blog
  • eXcelisys' Blog
  • Manjit Behera
  • Blue Feather's Blog
  • RCC's FileMaker News and Bits
  • Thorsen Consulting
  • DB Services Blog
  • FileMaker Magazine
  • Eye on FileMaker
  • Dev Talk
  • The Philosophy of FileMaker

Categories

  • Samples
  • Solutions
  • White Papers
  • Plug-Ins
  • FMGo

Found 2 results

  1. Here's some code I put together using the Ganymed SSH java library and examples to execute SSH commands using ScriptMaster. Its easier than doing SSH calls from RunShellScript. I'm sure there's improvements to be made. Cheers, JP // SSHCommand ( hostname ; privateKey ; username ; command ) // Uses Commons-Io-2.4.jar // Uses Commons-Lang-2.6.jar // Uses Ganymed-Ssh2-261.jar import java.io.IOException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import ch.ethz.ssh2.Connection; import ch.ethz.ssh2.Session; import ch.ethz.ssh2.StreamGobbler; final String stdout = new String(); final String stderr = new String(); 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" ); // Open seession and execute command final Session theSession = theConnection.openSession(); theSession.execCommand(command); // Get stdout stream and convert to string final InputStream stdoutStream = new StreamGobbler(theSession.getStdout()); final InputStream stderrStream = new StreamGobbler(theSession.getStderr()); stdout = IOUtils.toString(stdoutStream, "UTF-8"); stderr = IOUtils.toString(stderrStream, "UTF-8"); // Close streams stdoutStream.close(); stderrStream.close(); // Close the session and connection theSession.close(); theConnection.close(); if (StringUtils.isNotEmpty(stderr)) throw new RuntimeException( stderr ); // Return the string return stdout; } catch (IOException e) { throw new RuntimeException( e ); }
  2. 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