
Enviado em 19/01/2015 - 10:43h
Olá pessoal,#include <stdio.h>
#include <libssh.h>
int main()
{
char *user = "usuario";
char *password = "minhasenha";
const char *host = "192.168.1.10";
const int port = 22;
int rc;
int verbosity = SSH_LOG_PROTOCOL;
int v = 1;
ssh_session my_ssh_session;
my_ssh_session = ssh_new();
if (my_ssh_session == NULL)
return(-1);
ssh_options_set(my_ssh_session, SSH_OPTIONS_SSH2, &v);
ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, host);
ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, user);
rc = ssh_connect(my_ssh_session);
if (rc != SSH_OK)
{
fprintf(stderr,"Error connecting to host %s\n",ssh_get_error(my_ssh_session));
ssh_free(my_ssh_session);
return(-1);
}
rc = ssh_userauth_password(my_ssh_session, user, password);
if (rc == SSH_AUTH_SUCCESS)
{
printf("Authenticated correctly");
}
}
Jogando Daikatana (Steam) com Patch 1.3 via Luxtorpeda no Linux
LazyDocker – Interface de Usuário em Tempo Real para o Docker
Instalando COSMIC no Linux Mint
Turbinando o Linux Mint: o poder das Nemo Actions
Inteligência Artificial no desenvolvimento de software: quando começar a usar?
O widget do Plasma 6 Área de Notificação
[Resolvido] Algo deu errado ao abrir seu perfil
Instalar Dual Boot, Linux+Windows. (12)
Problemas com o "startx&... no Slackware (10)
Conselho distribuiçao brasileira (8)
Atalho no Linux Mint não aparece menu de troca de monitores (0)









