LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-07-2009, 03:21 AM   #1
Linuxfan0001
Member
 
Registered: Apr 2008
Posts: 47

Rep: Reputation: 15
how to use execv system call to launch remote application on redhat 5?


Hi
I am trying to use system call execv to launch an application on remote machine.
code snippet:
:
:
char* cmd[] = {"usepwdutility", (char*)0};
ret = execv("/xyz/root/pwdcheck/usepwdutility", cmd);
:
:
where xyz is remote machine name. i also tried substituting ipaddress of the machine in place of machine name. Error it gives is ENOENT

Please let me know in case of any info on this..

Thanks
 
Old 11-08-2009, 11:38 PM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
You cannot just simply run applications on remote computers. If what you tried worked, you could put any name there and execute arbitrary code on arbitrary Internet-connected computers.. a clear security problem.

Probably execvp("ssh", "ssh", "user@host", "command to run");. It is supposed to be ru in terminal; ssh will ask password from user. This, of course, implies that you know a login name of the user on the remote host.
 
Old 11-08-2009, 11:38 PM   #3
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
[deleted duplicate]

Last edited by raskin; 11-08-2009 at 11:41 PM. Reason: Mistaken double-post
 
Old 11-09-2009, 11:52 PM   #4
Linuxfan0001
Member
 
Registered: Apr 2008
Posts: 47

Original Poster
Rep: Reputation: 15
is there any other method to launch application on remote machine?
the scenario is:
Therez an application running on m/c 'A'which tells a deamon process on m/c 'B' to run a program. Now this program and parameters required by it are passed by the application on m/c 'A' to the deamon process running on m/c 'B'. the deamon process waits for the program to complete and sends back the exxit value of the program to the application running on m/c 'A'.
Please let me know the approach to implement above mentioned functionality.
Let me know in case of any clarification required.
Thanks
 
Old 11-10-2009, 12:02 AM   #5
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
SSH still meets your needs.
Code:
$ ssh -i ~/.ssh/id_dsa example.com "exit 17" ;
$ echo $?
17
-i allows you to specify "identity" - a secret key. If corresponding public key is added to ~/.ssh/authorize_keys of target user on target computer, and identity file is not protected by password, no password entering is required. Also, SSH returns exit code of remote process as own exit code.

Read "man ssh" and "man sshd".

What you need to keep in mind, though, is that the daemon in your design needs a way to be sure that the application is your nice application, not some spammer trying to send spam using your bandwidth. For ssh thi means that you want to protect your identity files well.
 
Old 11-10-2009, 01:09 AM   #6
Linuxfan0001
Member
 
Registered: Apr 2008
Posts: 47

Original Poster
Rep: Reputation: 15
i want to achieve mentioned functionality programatically. suppose i have remoteapplicationlauncher named out file. using this application i want to programatically send program name and its parameters thati want to run on remote machine.
suppose the application i want to run on remote m/c is usepwdcheckutility and parameters it take is const char* and int. with examples mentioned let me know the code snippet that will be used to achieve the requirement.
Thanks
 
Old 11-10-2009, 01:10 AM   #7
Linuxfan0001
Member
 
Registered: Apr 2008
Posts: 47

Original Poster
Rep: Reputation: 15
execvp("ssh", "ssh", "user@host", "command to run"); does not work...
 
Old 11-10-2009, 01:19 AM   #8
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
What happens when you do
Code:
execvp("ssh", "ssh", "user@host", "ls");
? Maybe I was wrong with argument count - then you need
Code:
execvp("ssh", "user@host", "ls");
You are supposed to run the test program in a terminal, by the way. It will be able to run without user interaction when you configure identities.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
suid application fails to call execv Ron_09 Linux - Newbie 0 05-12-2009 10:16 AM
Problem Running Remote X application on a 10.1 system kaplan71 SUSE / openSUSE 0 04-02-2009 10:57 AM
Starting a Java application from c++ using execv JaseyJaseJase Programming 1 09-17-2008 07:17 PM
how to add my own system call in RedHat linux9.0(2.4.7-20kernel) tyler28 Programming 0 06-15-2005 04:06 AM
NETPERF: ERROR --> send_udp_stream: error on remote: Interrupted system call dravya Linux - General 1 05-29-2004 05:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration