Thread: system call

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    9

    system call

    HEY ALL!!!!

    I still didn't figure out how i can open a ssh tunnel using a system call within my c code...

    can anyone give me a hint in this issue?!?

    Thanks a lot in advance
    Breno Kastrup

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    man ssh

    Code:
    NAME
         ssh - OpenSSH SSH client (remote login program)
    
    SYNOPSIS
         ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec] [-D port] [-e escape_char]
             [-F configfile] [-i identity_file] [-L  [bind_address:]port:host:hostport] [-l login_name]
             [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-R  [bind_address:]port:host:hostport]
             [-S ctl_path] [user@]hostname [command]
    
    DESCRIPTION
         ssh (SSH client) is a program for logging into a remote machine and for executing commands on a
         remote machine.  It is intended to replace rlogin and rsh, and provide secure encrypted communica-
         tions between two untrusted hosts over an insecure network.  X11 connections and arbitrary TCP/IP
         ports can also be forwarded over the secure channel.
    
         ssh connects and logs into the specified hostname (with optional user name).  The user must prove
         his/her identity to the remote machine using one of several methods depending on the protocol ver-
         sion used.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    9
    salem,

    thanks for the try, but this still didn't help much..

  4. #4
    old man
    Join Date
    Dec 2005
    Posts
    90
    Code:
    #include <stdlib.h>
    ...
    system ("ssh [see above man page]");
    Is this what you wanted? system() sends a command to the shell.

  5. #5
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    Or with slightly more work you could implement it without the hated system() function.
    Check out libssh

  6. #6
    Just kidding.... fnoyan's Avatar
    Join Date
    Jun 2003
    Location
    Still in the egg
    Posts
    275
    Hi all

    Never use system() since you have a fork()-exec() choice in UNIX world!

  7. #7
    Registered User
    Join Date
    Jan 2006
    Posts
    9
    Cool eerok, that's what i meant in the first place.....

    but fnoyan said not to use system..... why is that??

    so i should use the libssh valis pointed out instead?!

    I'll take a look at it and tell you guys how i'm going...

    Thanks a lot
    Breno

  8. #8
    Just kidding.... fnoyan's Avatar
    Join Date
    Jun 2003
    Location
    Still in the egg
    Posts
    275
    Hi

    Reading the below PDF will help you I think...

    http://www.advancedlinuxprogramming....-processes.pdf

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  2. Troubleshooting Input Function
    By SiliconHobo in forum C Programming
    Replies: 14
    Last Post: 12-05-2007, 07:18 AM
  3. Inline asm
    By brietje698 in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2007, 02:54 PM
  4. nanosleep() -system call does some confusing things
    By jtk in forum Linux Programming
    Replies: 5
    Last Post: 08-30-2007, 04:15 AM
  5. temperature sensors
    By danko in forum C Programming
    Replies: 22
    Last Post: 07-10-2007, 07:26 PM