Thursday, October 28, 2004

This is one for the command line geeks – remote.exe.

One of the lesser known (as is everything else command line based in the windows world) console tools that ship with windows is remote.exe. Its not earth shattering, but is a handy useful tool.

 

Remote.exe gives you an ability to connect to a command line program on another machine. What it does is that it can launch a console executable and stream its STDIN and STDOUT over the network to another system. It also can act as a client which can connect to this server session. Simple? It does not work on DOS exes and does not work with apps that manipulate the console via the console API, however it nicely streams standard windows console exes.

It works over a network and works over a modem dial in connection.

 

It’s a little like telnet, but not really. Unlike telnet it can limit the client to the usage of the particular application started by the server.

 

Also, here is a security hitch and a feature – the client that connects to the remote session is not verified (no user name password is asked for) – so virtually anyone can connect. However, when an application is remoted, a session name needs to be specified and the client needs to know the session name to connect to the machine.

 

Here is an example

> remote /S cmd session1

 

This starts cmd as the application that is remoted. The session name is (you guessed it) session1. the person who is connecting to server needs to say

> remote /C <machine name> session1

to connect to session ‘session1’ on the server machine. Neat? The client will have access to a cmd session on the server. The cmd session will be running in the security context of the person who ran the ‘remote.exe’ command (which is to say that the person can do as much good or as much bad as the user on the server machine is authorized to do).

 

Now if you fear the security of this approach here are two simple things to do –

 

The client needs to know the name of the session and cannot establish a connection without that. So your session names act as your first wall of defense. The client however can query a server for active sessions by

> remote /Q <machine name>

You can however choose not expose your session name to this sort of query by using the /-V option.

 

Secondly, if you are under a domain, then you can specify what users/groups are allowed to connect to your session. Simple :-)

 

Now go ahead and try out that remote.exe and play around with your system. It’s tremendously useful in a remote debugging scenario with kd or cdb (not ntsd – remember that opens a different console window). This is a useful tool esp in an intranet environment.

 

Finally, here is a help dump –

>remote

   To Start the SERVER end of REMOTE

   ---------------------------------

   Syntax : REMOTE /S <"Cmd">     <Unique Id> [Param]

   Example1: REMOTE /S "i386kd -v" imbroglio

            To interact with this "Cmd" from some other machine,

            start the client end using:  REMOTE /C <machine name> imbroglio

 

   Example2: REMOTE /S "i386kd -v" "name with spaces"

            start the client end using:  REMOTE /C <machine name> "name with spaces"

 

   To Exit: @K

   [Param]: /F  <Foreground color eg yellow, black..>

   [Param]: /B  <Background color eg lblue, white..>

   [Param]: /U  username or groupname

                specifies which users or groups may connect

                may be specified more than once, e.g

                /U user1 /U group2 /U user2

   [Param]: /UD username or groupname

                specifically denies access to that user or group

   [Param]: /V  Makes this session visible to remote /Q

   [Param]: /-V Hides this session from remote /q (invisible)

                By default, if "Cmd" looks like a debugger,

                the session is visible, otherwise not

 

 

   To Start the CLIENT end of REMOTE

   ---------------------------------

   Syntax : REMOTE /C <ServerName> "<Unique Id>" [Param]

   Example1: REMOTE /C <machine name> imbroglio

            This would connect to a server session on <machine name> with Id

            "imbroglio" if there is a REMOTE /S <"Cmd"> imbroglio

            running on <machine name>.

 

   Example2: REMOTE /C <machine name> "name with spaces"

            This would connect to a server session on <machine name> with Id

            "name with spaces" if there is a REMOTE /S <"Cmd"> "name with spaces"

            running on <machine name>.

 

   To Exit: @Q (Leaves the Remote Server Running)

   [Param]: /L <# of Lines to Get>

   [Param]: /F <Foreground color eg blue, lred..>

   [Param]: /K <Set keywords and colors from file>

   [Param]: /B <Background color eg cyan, lwhite..>

 

   Keywords And Colors File Format

   -------------------------------

   <KEYWORDs - CASE INSENSITIVE>

   <FOREGROUND>[, <BACKGROUND>]

   ...

   EX:

       ERROR

       black, lred

       WARNING

       lblue

       COLOR THIS LINE

       lgreen

 

   To Query the visible sessions on a server

   -----------------------------------------

   Syntax:  REMOTE /Q <machine name>

            This would retrieve the available <Unique Id>s

            visible connections on the computer named <machine name>.

 

Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview