Questions tagged [libssh]

libssh is a mulitplatform C library implementing the SSHv2 and SSHv1 protocol on client and server side.

libssh is a C library that enables you to write a program that uses the SSH protocol. With it, you can remotely execute programs, transfer files, or use a secure and transparent tunnel for your remote programs. The SSH protocol is encrypted, ensures data integrity, and provides strong means of authenticating both the server and the client. The library hides a lot of technical details from the SSH protocol, but this does not mean that you should not try to know about and understand these details.

libssh is a Free Software / Open Source project. The libssh library is distributed under LGPL license. The libssh project has nothing to do with "libssh2", which is a completely different and independent project.

libssh can run on top of either libgcrypt or libcrypto, two general-purpose cryptographic libraries.

218 questions
1
vote
1 answer

SSH connection through C++ libssh refuses to connect

I am trying to create a simplified SSH connection between client and server with libssh library in C++. My code is as displayed below: ssh_session session; session = ssh_new(); if(session == NULL) { cout <<…
user13754741
1
vote
0 answers

libssh opening flle on remote machine - SFTP server permission denied error debug

I use a server as a jump host (Host A) to ssh to machine on an internal network (Host B). I use this ssh command and it works OK. ssh -J user@hostA_IP.com root@hostB_IP.com Similarly I can scp files to Host B with: scp -o 'ProxyCommand ssh…
tommy
  • 51
  • 1
  • 5
1
vote
0 answers

Libssh channel request exec failed in C

I'm using Libssh to log into an ethernet switch and run commands. I can connect and log in just fine but commands cannot be run. The program just returns "Channel request exec failed" as the ssh error. Normal ssh outside of the program works as…
Amino
  • 11
  • 1
1
vote
0 answers

libssh/scp - Copying the contents of a remote directory except some specified subfolders

I am writing a C program to copy a directory from a remote machine using libssh and scp. This directory contains a large number of subfolders and I want to exclude several (less than 10) of them. I tried iterating over the subfolders that I need (I…
anuki16
  • 9
  • 3
1
vote
0 answers

Detect timeout on Windows and Linux with Libssh

In the testing I'm doing I have noticed that (both with blocking mode): On Linux ssh_channel_read_timeout when command timeout answer 0 (readBytes). On Windows ssh_channel_read_timeout when command timeout answer -1 (readBytes). Both call the same…
bruno bb
  • 152
  • 9
1
vote
1 answer

libssh's functions couldn't be found on qt and cmake error while building libssh

I want to use libssh library in Qt and my os is ubuntu 18.04 . so I cloned the library's file and tried to build it with cmake. I followed the tutorial in INSTALL folder but the building process can't be completed. at first I had this error : Could…
fa7eme
  • 73
  • 10
1
vote
0 answers

Creating reverse tunnel with LibSSH

I have created a simple server and client with following code: Client int main() { ssh_session my_ssh_session; int rc; char* password; my_ssh_session = ssh_new(); if (my_ssh_session == NULL) { exit(-1); } int…
qweqwe
  • 33
  • 6
1
vote
0 answers

Is there a way to use the configuration values from ~/.ssh/config from libssh?

I'm writing a program which needs to execute remote commands, and it would be very convenient to leverage the configurations which are already present on my machine. I.e. in my ~/.ssh/config file, I have servers declared like this: Host my-server …
sak
  • 2,612
  • 24
  • 55
1
vote
1 answer

Windows path problems using libssh C++ wrapper

I am having problems with Windows file path separators using the libssh c++ wrapper libsshpp. Suppose I have following code: #define SSH_NO_CPP_EXCEPTIONS #include "libssh/libsshpp.hpp" #include #pragma comment(lib, "ssh") int main()…
tai
  • 477
  • 1
  • 5
  • 16
1
vote
1 answer

SSH Connection failed : Failed to process system configuration files

I'm trying to make a simple SSH connection between ssh client which is on my notebook's Windows 10 and Ubuntu which is installed on VMWare. I use libssh for ssh support and Qt Creator as IDE. Here is the piece of code: int verbosity =…
Razvan Nechita
  • 113
  • 1
  • 5
1
vote
1 answer

C - libssh and sftp - client/server - creating sftp session hangs

I implemented a client/server communication over SSH with libssh. I also want to implement file upload from client to the server now and have been following the doc for it. However, it hangs on the call sftp = sftp_new(session);. Do I have to…
phoebus
  • 1,280
  • 1
  • 16
  • 36
1
vote
2 answers

How to dynamically allow users in OpenSSH?

I want to be able to block or allow users based on the result of an external script using OpenSSH. I see that libssh has support for callbacks, but after reading the OpenSSH man pages I cannot find anywhere that this functionality is handed to the…
Isaiah Taylor
  • 345
  • 1
  • 2
  • 7
1
vote
1 answer

Using Cmake to build ssh.dll with Visual Studio 2017

I am a beginner in C++ and I am trying to build ssh.dll on Windows 32bit using Visual Studio 2017 and cmake. I have downloaded the latest version of libssh and tried to build ssh.dll from the source by using cmake after configuring and generating…
CodeHunter
  • 2,017
  • 2
  • 21
  • 47
1
vote
1 answer

How to properly include libssh in C

I am getting an error every time I try to compile my code with gcc on Ubuntu. I installed libssh-dev by typing: sudo apt-get install libssh-dev and it installed just fine (No error messages) The code I am trying to compile is: #include…
anon
  • 23
  • 1
  • 5
1
vote
1 answer

malloc issues with parallelization of ssh calls using threads

I'm trying to do multiple ssh connections(using libssh 0.7.5) and parallelizing them using boost::threads. Upon parallelization I observed that of the 20 executions of my executable 3 failed with glibc "double free or corruption" error , while 2…
Abhinav Jain
  • 59
  • 10