nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Execute commands via ssh

This is a discussion on Execute commands via ssh within the CentOS / RHEL / Fedora forums, part of the Linux Distribution category; Team, Could anyone tell me how to issue a command (ex: who) via ssh and put the out put back ...


Go Back   nixCraft Linux Forum > Linux Distribution > CentOS / RHEL / Fedora

Linux answers from nixCraft.


CentOS / RHEL / Fedora Discussion about Redhat Enterprise Linux or CentOS or Fedora Linux related problems.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 18-11-2008, 04:52 AM
Junior Member
User
 
Join Date: Nov 2008
OS: centos
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
java.beans is on a distinguished road
Default Execute commands via ssh

Team,
Could anyone tell me how to issue a command (ex: who) via ssh and put the out put back on the same computer where you issues the original command?

Thanks bunch!
Reply With Quote
  #2 (permalink)  
Old 18-11-2008, 11:21 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Have you tried it as follows:
Code:
ssh user@server.com who > output.txt
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #3 (permalink)  
Old 19-11-2008, 05:35 AM
Junior Member
User
 
Join Date: Nov 2008
OS: centos
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
java.beans is on a distinguished road
Default

Hi Vivek,
Thanks for the response. Actually I already tried it and it works perfectly fine. What I am trying to achieve over here is bit complicated. The scenario would be let say you have two boxes (A and B). Box “B” has Nmap installed and you want to execute Namp command on box “B” via SSH from the box “A” and SCP the Nmap output to the box “A”. I want to achieve this with one command. Is it possible?
Reply With Quote
  #4 (permalink)  
Old 19-11-2008, 04:31 PM
Junior Member
User
 
Join Date: Feb 2008
OS: CentOS
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jitendra is on a distinguished road
Send a message via MSN to jitendra
Default

Hi,

For this better u write a shell script.

Regards,
Jitendra
Reply With Quote
  #5 (permalink)  
Old 01-05-2009, 07:35 PM
Senior Member
User
 
Join Date: Jul 2006
Posts: 145
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 4
asim.mcp is on a distinguished road
Default

visite the following url. This will help you.


System Administration Toolkit: Distributed administration using SSH
Reply With Quote
Reply

Tags
command line , files , linux , ssh


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Execute UNIX Command / Shell Script Once In The Future permalac Shell scripting 2 27-08-2008 08:13 PM
How to monitor RSH commands mformit Solaris/OpenSolaris 0 11-04-2008 09:44 PM
If file modified execute a script karabaja Shell scripting 3 23-11-2006 02:39 AM
using shell commands in C steve Coding in General 2 14-10-2005 09:25 AM
#why following cannot be execute? ryan Shell scripting 7 16-03-2005 06:50 PM


All times are GMT +5.5. The time now is 04:36 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38