LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-05-2006, 07:02 AM   #1
alix123
Member
 
Registered: Nov 2004
Posts: 63

Rep: Reputation: 15
Question URGENT: How to execute a Linux command remotely


I want to execute a command remotely using perl script from windows to linux, for example

Assume that there is remote Linux machine say 192.168.251.19
i know the login and password of Machine as
login: root
password : root123

Now from the Remote Windows Machine with the above details I want to execute a command on linux say 'reboot' command or 'ps' command or any other command.

Is there any utility for windows/linux so that i can execute the commands remotely from windows (there should not be any user interaction required).

Basically i will be able to call that utility from my perl program if there are no user interaction,a kind of silent command execution
 
Old 04-05-2006, 07:11 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
this is not urgent for anyone here, please do not expect people to jump to help you just because you felt you could use "URGENT" in the title...
 
Old 04-05-2006, 01:53 PM   #3
astorm
LQ Newbie
 
Registered: Nov 2005
Distribution: Slackware
Posts: 23

Rep: Reputation: 15
Make sure you have an ssh daemon (sshd) running on the Linux machine and ssh to it from the Windows machine using PuTTY. Read the PuTTY manual for a more detailed explanation, although its UI is pretty straightforward.

I hope root123 is a fake password.

Last edited by astorm; 04-05-2006 at 07:52 PM.
 
Old 04-05-2006, 08:12 PM   #4
ckoniecny
Member
 
Registered: Oct 2005
Posts: 162

Rep: Reputation: 30
Look at rcp
 
Old 04-06-2006, 01:38 AM   #5
alix123
Member
 
Registered: Nov 2004
Posts: 63

Original Poster
Rep: Reputation: 15
Using a Putty client requires User interaction

Using a Putty client requires User interaction. Which is problem for the autmated scripts.

I even tried the Command line version of putty i.e plink but it again requires user interaction to accept the key of the linux machine.

any other utility to exeucte the Remote linux command from windows silently (no user interaction) given the root user name and password.

Last edited by alix123; 04-06-2006 at 01:40 AM.
 
Old 04-06-2006, 01:44 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you can run ssh within expect under cygwin
 
Old 04-06-2006, 02:16 AM   #7
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
I am not sure if this works with Putty as well, but here are instructions on how to use ssh with no password prompt (At the bottom of the page). Basically, it is using a private / public key pair to do the authentication instead of a password.

I hope this helps
--Ian
 
Old 04-06-2006, 03:00 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Yep, you can use auth_keys and call ssh using system() cmd or Net::SSH module.
 
  


Reply



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
C program code to execute linux-command supermichou_fr Linux - Software 4 08-01-2012 08:25 AM
Execute a linux command using a java program tvalenzuela Programming 2 10-07-2005 11:59 AM
Can't login remotely via new user created. Urgent help needed geomonap Red Hat 4 09-26-2005 02:44 PM
Using FTP to execute command line commands remotely steve_2010 Solaris / OpenSolaris 4 02-13-2004 08:44 AM
is there any linux command to download files from any ftp site remotely midnitc Linux - General 3 10-31-2003 08:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:00 AM.

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