com.jcraft.jsch.OpenSSHConfig Java Examples

The following examples show how to use com.jcraft.jsch.OpenSSHConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SftpClientFactory.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
private static void setConfigRepository(final JSch jsch, final File sshDir, final ConfigRepository configRepository, final boolean loadOpenSSHConfig) throws FileSystemException {
    if (configRepository != null) {
        jsch.setConfigRepository(configRepository);
    } else if (loadOpenSSHConfig) {
        try {
            // loading openssh config (~/.ssh/config)
            final ConfigRepository openSSHConfig = OpenSSHConfig.parseFile(new File(sshDir, OPENSSH_CONFIG_NAME).getAbsolutePath());
            jsch.setConfigRepository(openSSHConfig);
        } catch (final IOException e) {
            throw new FileSystemException("vfs.provider.sftp/load-openssh-config.error", e);
        }
    }
}
 
Example #2
Source File: SshConfiguration.java    From ssh-proxy with Apache License 2.0 4 votes vote down vote up
public static SshConfiguration getConfiguration() throws IOException, JSchException {
	Assert.isTrue(Files.isRegularFile(getLocalSshConfigPath()), getLocalSshConfigPath() + " does not exist");
	return new SshConfiguration(OpenSSHConfig.parseFile(getLocalSshConfigPath().toString()));
}