LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 06-07-2005, 04:29 AM   #1
shivaligupta
Member
 
Registered: Oct 2004
Posts: 45

Rep: Reputation: 15
Question rcmd for remote execution


I want to execute one command "poweroff" on one pc after getting an instruction from other pc. i tried rcmd but m not able to get tht how to use it. i m implementing my program in C/C++
plz help if u know anything about rcmd or anyother way to do this.
thanks in advance
 
Old 06-07-2005, 08:24 AM   #2
huibert.alblas
Member
 
Registered: Jan 2004
Location: Duesseldorf /Germany
Distribution: Gentoo amd64 / Debian
Posts: 226

Rep: Reputation: 30
I would suggest usinf SSH, I don't know if it is a good idea to hack into a C programm or how to do it.
I'm more a bash/java hacker kind of guy.

Other wise I can think a et least 10 other ways how to remotly shutdown a computer runninf linux...
But don't have the time to write them down right now :-)

Depends if you _need_ C as a language (school asignment ?) or just want to get the job done.

Happy hacking
 
Old 06-09-2005, 10:41 PM   #3
shivaligupta
Member
 
Registered: Oct 2004
Posts: 45

Original Poster
Rep: Reputation: 15
If u know 10 other ways plz tell me two or three. i really want to know them
thanks
 
Old 06-10-2005, 06:19 AM   #4
huibert.alblas
Member
 
Registered: Jan 2004
Location: Duesseldorf /Germany
Distribution: Gentoo amd64 / Debian
Posts: 226

Rep: Reputation: 30
Simplest way:
(1)
Code:
ssh root@rometesite -c "halt"
Better:
(2)
Code:
ssh user@remote
bash ~/ > sudo halt
(enter password)
Nifty but dumb (every local user /every body with write permissoin to /tmp can shutdown your computer):
(3)
Code:
- create script which:
 - checks for file /tmp/shutdown.txt
 - if file exists do shutdown
 - else NOP
Put script in roots crontab
Server
(4)
Code:
- create some kind of socket listner server, listing on som port
- connect to server, put message in socket stream
- if message is "shutdown" do shutdown
(5)
Add some authentication to (4)

(6)
If you look at it the right way, you will see that (5) is basicly (2) but very primitive.

(7)
Combine any of the above...


user your imagination:
What you basicly want ist to dispatch a message from computer Remote1 to computer remote2.
If message correct, then Remote2 must do shutdown.

In stead of ssh you could use HTTP, FTP, SFTP, SMTP or whatever other protocol to comunicate.

"Free your mind, and the rest will follow!"

Happy hacking
 
  


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
"rcmd socket : All ports in use" Error alchimiste Linux - General 1 10-26-2006 10:33 AM
Remote Execution issinho Linux - Networking 5 07-08-2005 01:11 PM
Thorny remote execution question davidcrawley Linux - Software 3 09-03-2004 02:32 PM
Remote Command Execution via mobile phone Sammy2ooo Linux - Software 6 06-27-2003 03:42 AM
"rcmd socket : All ports in use" Error alchimiste Linux - Networking 0 02-18-2003 04:57 AM


All times are GMT -5. The time now is 03:30 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration