LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-13-2013, 08:09 PM   #1
VarinaW
LQ Newbie
 
Registered: Apr 2013
Posts: 3

Rep: Reputation: Disabled
How to list processes remotely without using ssh?


Is there a way to list the processes (i.e. "ps" or "top") on a remote computer without using ssh?

If ssh is the only way, then I need to figure out why my remote computer isn't allowing any ssh commands, which is a different issue/posting.

Ideally, I could type "ps 192.168.x.x" and it just works, but I'm not seeing any such syntax when I search.
 
Old 04-13-2013, 08:37 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by VarinaW View Post
Is there a way to list the processes (i.e. "ps" or "top") on a remote computer without using ssh? If ssh is the only way, then I need to figure out why my remote computer isn't allowing any ssh commands, which is a different issue/posting.

Ideally, I could type "ps 192.168.x.x" and it just works, but I'm not seeing any such syntax when I search.
SSH isn't working for you, because you're not using SSH. If you want to use SSH to run a command on a remote server, you have to issue the command WITH SSH:
Code:
ssh <user>@<server> <command>
Read the man page on SSH. Something like "ssh <user>@<server> "ps 192.168.x.x"" will work.
 
Old 04-13-2013, 08:37 PM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
if you were crafty enough you could redirect the output of /ps/ to a file and serve it thru http.

to diagnose ssh try running the server as /sshd -d -d -d/
and run the client with /ssh -v -v -v/
 
Old 04-13-2013, 08:53 PM   #4
VarinaW
LQ Newbie
 
Registered: Apr 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
SSH isn't working for you, because you're not using SSH. If you want to use SSH to run a command on a remote server, you have to issue the command WITH SSH:
Code:
ssh <user>@<server> <command>
Read the man page on SSH. Something like "ssh <user>@<server> "ps 192.168.x.x"" will work.
Semantics aside, the only way to view a list of remote processes in Linux is to begin a command-line with "ssh..."? I'm a Windows user and can do what I'm asking very easily. Yet, I'm trying to learn Linux and am quite surprised by the lack of commands to do the same thing.

I'm almost certain it can be done in Linux WITHOUT ssh. I'm just not seeing any clear answers.
 
Old 04-13-2013, 09:17 PM   #5
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
there's 101 ways to skin this cat. the most strait-forward way is to just login remotely using /ssh/. else you can create a few scripts and turn on a few services to pipe the output of the command to a file and serve it thru http, ftp, nfs, samba, netcat, email, telnet, vnc, rsh, rdp, sneakernet, ...
this is basically a question like 'what's the best way to drive to work'.

how does one get the list of running processes from a remote windows machine ?

Last edited by schneidz; 04-13-2013 at 09:27 PM.
 
Old 04-13-2013, 09:37 PM   #6
VarinaW
LQ Newbie
 
Registered: Apr 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks, schneidz. To refine your drive analogy, I'm trying to find a way to drive to work, by avoiding a particular highway. In my case, "Highway ssh".

So far no one has been able to provide clear directions on how to do that in Linux. Sorry, but "you can create a few scripts and turn on a few services to pipe the output of the command to a file and serve it thru http, ftp, nfs, samba, netcat, email" doesn't help someone who's new to Linux. Try asking your neighbor to do that.

There's no Linux utility or command to view running processes on a remote box, without going through ssh?
 
Old 04-13-2013, 11:31 PM   #7
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
You have to have some way of sending a command to the remote system. Your local ssh client does that. There has to be something on the remote system that is listening for incoming connections. Your remote ssh server does that. Or you could use rsh (remote shell), but it isn't encrypted and secure like ssh, so ssh is the preferred method.

ssh [USER-NAME]@[REMOTE-HOST] [command or script]

Here's an example that logs in to a remote system, executes the free command to display memory information on the remote system, pipes the output to grep to look for the line with the numeric values, then pipes it to awk to reformat it. That's maybe not all that useful, but it demonstrates the concept.

ssh user@myhost.com free -m | grep "Mem:" | awk '{ print "Total memory (used+free): " $3 " + " $4 " = " $2 }'


Out of curiousity, how do you do what you are asking from one Windows system to another?
 
Old 04-14-2013, 12:02 AM   #8
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by VarinaW View Post
Thanks, schneidz. To refine your drive analogy, I'm trying to find a way to drive to work, by avoiding a particular highway. In my case, "Highway ssh".

So far no one has been able to provide clear directions on how to do that in Linux. Sorry, but "you can create a few scripts and turn on a few services to pipe the output of the command to a file and serve it thru http, ftp, nfs, samba, netcat, email" doesn't help someone who's new to Linux. Try asking your neighbor to do that.

There's no Linux utility or command to view running processes on a remote box, without going through ssh?
yes, but there's a difference tween 'how to drive to work' and 'how to drive a car'. I would expect a cab driver to know how to operate a car.
Code:
telnet hostname
ps auxw
exit
replace hostname with the host name or ip- address of the machine you are trying to connect to.

I would suggest your ssh woes mite be due to you not punching the required hole in your router ?

Last edited by schneidz; 04-14-2013 at 12:10 AM.
 
Old 04-14-2013, 01:07 AM   #9
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Quote:
Originally Posted by VarinaW View Post
There's no Linux utility or command to view running processes on a remote box, without going through ssh?
Then the remote computer must have another service besides ssh that would entertain commands to list processes on it I guess as you can't do that in ssh unless you make another remote command do that there. Ssh does not work like the vulnerable rpc in windows sorry. And I'm not sure if there's a service like that which you could "set-up" on your remote computer for that.

You could create a quick service like a looping script with netcat that would accept input and output redirected from remote connection and recognize commands that would make it execute yet-another-process to list the processes. The connection could then be tunneled securely with stunnel.

Or perhaps you could find some services around the net that would provide such functionality.

Like this one: https://mmonit.com/monit/

Or perhaps you were wanting to have a command that would wrap-up the tasks of logging in and execute the ps or top command on the remote machine, and list them with a more presented output? But doesn't that execute commands remotely as well?

A shell script might be what you also needed.

Last edited by konsolebox; 04-14-2013 at 01:12 AM.
 
Old 04-14-2013, 07:22 AM   #10
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
good point konsolebox, I guess this could be what the original poster is looking for. if you have a remote desktop server running you could do
Code:
rdesktop hostname
 
Old 04-14-2013, 08:51 AM   #11
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by VarinaW View Post
Semantics aside, the only way to view a list of remote processes in Linux is to begin a command-line with "ssh..."? I'm a Windows user and can do what I'm asking very easily. Yet, I'm trying to learn Linux and am quite surprised by the lack of commands to do the same thing.

I'm almost certain it can be done in Linux WITHOUT ssh. I'm just not seeing any clear answers.
The only way to do something on a remote system is to have something that can be connected to from your local system...

For general purpose operations, that "something" is ssh. If you wanted to retrieve a web page from a remote system, the remote system must be running a web server...

ssh is a general service that authenticates remote connections. Are there equivalences? yes - web server, running a telnet service (or a secure one), running an insecure service such as netcat...
Lots - but in all cases, something must be running on the remote system to respond.

Since most linux distributions are designed to be secure, a generic service must be available, and secured - and ssh provides that service.
 
Old 04-14-2013, 05:02 PM   #12
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by VarinaW View Post
Semantics aside, the only way to view a list of remote processes in Linux is to begin a command-line with "ssh..."? I'm a Windows user and can do what I'm asking very easily. Yet, I'm trying to learn Linux and am quite surprised by the lack of commands to do the same thing.

I'm almost certain it can be done in Linux WITHOUT ssh. I'm just not seeing any clear answers.
As others have pointed out, you CAN do it without SSH, but I'm not sure why you're hesitant to use it. It's pretty much a 'standard', is simple to use (and to script for), has great support amongst ALL variants of unix/linux, and can also support file transfer. All that one one port, and it's encrypted. If all you want to do is check basic system info, you might want to look at SNMP, and see if what you're wanting is already reported by the SNMP daemon, but even at that, you're still querying a remote service to return information, just like you would with SSH, web, or any other Windows service.

Yes, you can do it in Windows...sort of. You are STILL connecting to a service of SOME type on the other end; and I'll sidestep the whole security issue that Windows suffers from as a result of those methods.
 
Old 04-14-2013, 06:55 PM   #13
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by TB0ne View Post
you might want to look at SNMP
...finally somebody who mentions SNMP ;-p


Quote:
Originally Posted by TB0ne View Post
but even at that, you're still querying a remote service to return information, just like you would with SSH, web, or any other Windows service.
Well you could send traps and notifications to a central management console just like you would with any monitoring agent, right?
 
Old 04-14-2013, 06:58 PM   #14
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by schneidz View Post
you could redirect the output of /ps/ to a file and serve it thru http.
No need to save it to a file, just serve it with Xinetd like this:
Code:
# default: off
# description: Xinetd output of 'ps'. 
service ps
{
        disable         = yes
        type            = UNLISTED
        protocol        = tcp
        port            = 60001
        socket_type     = stream
        wait            = no
        user            = root
        log_on_failure  += HOST 
        server          = /bin/ps
        server_args     = axfwww -eo pid,ppid,sid,uid,nice -eo %C -eo args --sort=pid
        only_from       = 127.0.0.1 10.0.1.0/24
}
 
2 members found this post helpful.
Old 04-15-2013, 06:54 AM   #15
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by unSpawn View Post
No need to save it to a file, just serve it with Xinetd like this:
Code:
# default: off
# description: Xinetd output of 'ps'. 
service ps
{
        disable         = yes
        type            = UNLISTED
        protocol        = tcp
        port            = 60001
        socket_type     = stream
        wait            = no
        user            = root
        log_on_failure  += HOST 
        server          = /bin/ps
        server_args     = axfwww -eo pid,ppid,sid,uid,nice -eo %C -eo args --sort=pid
        only_from       = 127.0.0.1 10.0.1.0/24
}
Ah yes, an unauthenticated connection.... and running as root to boot. A good way to provide a DOS attack (just overload the process table).

Oh, xinetd only works on the current and older RH based/derived systems... but appears to be discontinued in the next release.
 
  


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
Killing processes remotely using SSH ddenton Linux - General 8 12-30-2013 08:22 PM
[SOLVED] Possible to remotely list supported cipher suites? szboardstretcher Linux - Security 4 11-30-2011 02:37 PM
adding proc list and task list of active processes. pravin.embedded Linux - Newbie 1 09-02-2008 01:20 PM
How to kill processes using ssh remotely rajaniyer123 Solaris / OpenSolaris 3 04-13-2008 01:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:12 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