-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclitest.cpp
More file actions
42 lines (33 loc) · 977 Bytes
/
Copy pathclitest.cpp
File metadata and controls
42 lines (33 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <libssh/libssh.h>
#include <stdio.h>
int main (int argc, char * argv[])
{
// parametres
char hostname[15];
unsigned int portnum;
char username[15];
char password[15];
int verbosity = SSH_LOG_PROTOCOL;
ssh_session my_ssh;
printf ("hostname = %s\n", hostname);
printf ("port number = %d\n", portnum);
printf ("username = %s\n", username);
printf ("password = %s\n", password);
printf ("verbosity = %d\n", verbosity);
printf("Press any key to connect with these params\n");
// opening session
my_ssh = ssh_new();
if (my_ssh == NULL)
return -1;
printf ("session opened\n");
// settings
ssh_options_set(my_ssh, SSH_OPTIONS_HOST, hostname);
ssh_options_set(my_ssh, SSH_OPTIONS_VERBOSITY, &verbosity);
ssh_options_set(my_ssh, SSH_OPTIONS_PORT, &port);
// ssh_options_set(my_ssh, SSH_OPTIONS_HOST, hostname);
// ssh_options_set(my_ssh, SSH_OPTIONS_HOST, hostname);
// closing session
ssh_free(my_ssh);
printf ("session closed\n");
return 0;
}