Hi Shilpa,
The easiest option is using
JMeter SSH Sampler (you'll need to compile it and drop to JMeter classpath (usually /lib or /lib/ext folder).
If it doesn't provide functionality you need you can consider using
ant-jsch or
Jsch library (both of them provide exec and file SSH2 channels so it's possible to execute SSH commands and download/upload files using them). Again you'll need to add required jar(s) to JMeter classpath, restart JMeter and use i.e. Beanshell Sampler.
Relevant Beanshell Code to perform file upload looks as follows:
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.optional.ssh.Scp;
boolean useKeyAuthentication = true;
String username = "user";
String password = "secret";
String host = "127.0.0.1";
String remotePath = "/home/user/file.to.upload";
String localPath = "C:\\Users\\me\\Desktop\\file.to.upload";
int sshPort = 22;
Scp scp = new Scp();
Project p = new Project();
scp.setProject(p);
StringBuilder remote = new StringBuilder();
if (useKeyAuthentication) {
scp.setKeyfile("/path/to/private/key/file");
scp.setPassphrase("passphrase");
remote.append(username).append("@").append(host).append(":").append(remotePath);
} else {
remote.append(username).append(":").append(password);
remote.append("@").append(host).append(":").append(remotePath);
}
scp.setFile(localPath);
scp.setRemoteTofile(remote.toString());
scp.setPort(sshPort);
scp.setTrust(true);
scp.execute();
Hope this helps.