public class SSHServer extends Object
| Constructor and Description |
|---|
SSHServer(File cwd,
File keyFile,
int port,
boolean allowLocalUser,
Map<String,String> authorizedUsers) |
SSHServer(File cwd,
Map<String,String> authorizedUsers) |
| Modifier and Type | Method and Description |
|---|---|
static String |
generatePrivateKey()
Utility to generate an SSH-style private key
|
int |
getPort() |
static String |
getPublicKey(String privateKey)
Reads an SSH-style private key and provides the encoded public key portion
|
void |
start() |
void |
stop() |
public SSHServer(File cwd, Map<String,String> authorizedUsers)
cwd - directory to use as root for serving filesauthorizedUsers - a list of username -> ssh public keys to allowpublic SSHServer(File cwd, File keyFile, int port, boolean allowLocalUser, Map<String,String> authorizedUsers)
cwd - directory to use as root for serving fileskeyFile - an RSA private key file, or null to generate a new oneport - port to run the ssh server on, 0 toallowLocalUser - allows the local user based on ~/.ssh/id_rsa.pubauthorizedUsers - a list of username -> ssh public keys to allowpublic void start()
throws IOException
IOExceptionpublic void stop()
throws IOException
IOExceptionpublic int getPort()
public static String generatePrivateKey()
Copyright © 2017. All rights reserved.