remote execution in windows server via telnet - windows

I need to start a process and keep it running on several remote windows (03 and 08) servers.
When I telnet in and start the process and sign out of my telnet session, the process dies.
I changed the registry settings so the pertinent tlntadmn output looks like this:
End tasks on disconnect : NO
restarting the service and/or rebooting the server have had no effect. My processes still die when the telnet session ends.
Any advice?

My advice would be to ask this question at serverfault.com, which is similar to SO but focuses on sysadmin stuff. As I know near nothing about telnet, if you can't figure this out take a look at PsExec, which will let you run executables on remote machines in various ways.

Related

Is it possible to run cmd commands over rdp?

I have multiply computers in my network which i need to automate some script. the only port can be used for that is rdp (3389), and I need to find a way to run commands over thid rdp port, without the GUI stuff.
what i am looking for is something like winRM, where i can enter remote session in powershell/cmd.
note: I cant use winRM/smb/rpc for that task. only rdp.
and if it won't disconnect the user logged in to the computer it will be even better...
so is something like this possible?
thanks!

How to reconnect to lost VNC server on mac

I'm using ssh tunneling, vncserver, and the default Mac Screen Sharing app to run a GUI on a remote server (university clusters). It works really well in general, but often if left too long or after moving my laptop to another wifi network (eg, from home to campus) I lose connection to the remote server and Screen Sharing gets stuck in the "Reconnecting" forever.
It appears that the GUI is still running on the remote server because when I write vncserver -list in ~/.vnc it still has the .pid file (and I never used the -kill command). How can I reconnect to this vncserver? When I enter vnc://localhost:59xx in Screen Sharing it says
Connection failed to "localhost".
Make sure Screen Sharing or Remote Management is enabled on the remote computer
I'd really like to reconnect to this remote server because I'm running time-consuming and time-sensitive processes that I need to check the status of from time to time, and I need to make sure that the program successfully saves the output of my program.
Thank you!
Figured it out. I didn't realize that the localhost was based on my IP address, so when I moved locations the ssh tunnel collapsed. All I had to do was recreate the tunnel (ssh -L 59xx:localHost:59xx -N -f name#cluster.edu and I was able to reconnect to the port with Screen Sharing.

Why SSH server on windows7 x86 failed, while SSH client working

I am working recently on building Hadoop environment on windows7 OS. However, I got stuck in SSH configuration which blocks all the remaining work for Hadoop. I believe it's nothing to do with Hadoop, so any one familiar with SSH can do me a great favor.
Here's the thing, I'm trying to install SSH service for two computers so that any one can communicate with the other. I have successfully installed SSH for my PC, which is win7-x64, through cygwin. However, when I repeated it on the other computer, which is a server with win7-x86, SSH server failed, while the client can work, I get totally confused.
For my PC, I installed cygwin to use SSH service. ssh localhost works fine. And after generating ssh keys and appending it to authorized_keys, I managed to log in to my PC without password.
I copied the cygwin folder from my PC to the server, which is not connected to the Internet thus cygwin can't be directly installed on it. ssh localhost turned out okay at the first. But when I attemptted to log in without password by generating ssh keys and appending to authorized_keys, I got
Connection to localhost closed by remote host
Connection to localhost closed.
What's more, I copied the public key of the server to my PC and appended to authorized_keys file. I managed to log in to PC from the server without password.
On the other hand, the SSH connection from PC to server failed no matter whether with or without password. I got the same failure:
Connection closed by 192.168.0.52
where 192.168.0.52 is the ip address of the server.
What makes me more confused is when I connected to server from PC using putty rather than ssh command, I could log in to the server, with password.
In conclusion, I hope it would make the question more clearer with this graph:
ssh connection graph
I hope any one can help me to figure out what's wrong and how to fix it. Thanks a lot!
After trying for several centries, I finally found what's happening. When I built sshd service on the server, I didn't create a privileged account('cyg_server' by default), which I did on my PC but I forgot. Instead, I used current account for logging. Yet, the account , even the administrator, on windows doesn't have all the authorities as root on Linux does. Considering that, Cygwin considerately creates a privileged account named 'cyg_server', we just leave it and log in using current account. Everything is okay!
Again, f**k windows(So why would I have to do that on windows. Well, if I could, I would)

Detect RDP Session on Remote WinXP machine (not on local network or domain)

I have set up a Win XP machine at work that we use as our server, to allow RDP connections. This allows all our staff to access the server from home when needed. As it is not a server OS, we are missing many of the terminal services features a regular server would have. The machine only allows one RDP session at a time (which is a minor inconvenience, but not a big deal).
What is bothersome, is that no one can tell if the server is currently being used in an RDP session, and we all keep booting each other off. Every solution I have found online assumes the remote computer is a Server OS or on a local network/domain. Our staff's home computers are not connected to the office network and we have no domain set up at the office.
Is there any way to tell if the server is in an RDP session before remoting onto the server from home? Ideally we would be able to detect which home computer is accessing the server. But if that is not possible, it would be extremely helpful to at least know that an RDP session is running.
We were previously using logmein, which could tell us if the remote computer keyboard and mouse were active and allow a chat with the user currently remoted on/physically on the machine. This was extremely convenient, but involves logging onto the logmein website and going through a semi-lengthy process of connecting. It is also much slower and resolution is much worse than RDP. Not super convenient for regular daily use.
This post deals with the same issue
https://superuser.com/questions/313390/ways-to-check-if-user-is-active-on-remote-machine-before-rdping
but the accepted response is to use qwinsta on cmd, which I believe is only available on server OS's. Other responses include using psexec (I've tried using psloggedon.exe, but this appears to only work for users on the same domain). Another suggests using the wmic.exe command, but when I try that I get the error: The RPC Server is unavailable (I think this also needs to be run on the same domain).
So basically - is there any way to check for active rdp sessions on a Win XP machine from a remote computer not on the local network/domain?
I'm open to outside-the-box solutions like writing a simple app to run on the xp server and tell remote machines what IP is connected in an RDP session.
Going on Harry Johnston's suggestion, I wrote an app which finds who is connected to the xp machine on port 3389, and relays that information by udp to receiving apps. Now we can check if someone is connected and who it is before unwittingly booting them off. Thanks Harry!

How to check programmatically the OS of remote host?

I need to check if remote host is Windows or Unix/Linux.
I can't assume that it has web server configured.
All I can do is to try to connect to several TCP or UDP services.
Which TCP services (TCP port numbers) usually will be opened on Windows and not on Unix/Linux and vise versa?
The other way is to try to ssh to it, and if it fails assume that it Windows host. The problem is, that I need this in order to choose the remote access method ssh or something Windows friendly like psexec.
You can read the output of nmap to detect which OS a remote host is running. It has a whole module dedicated to this. Here is a guide to using it.
Why not just try to connect one way, and if that fails, connect the other way, and if neither work, tell the user?
If that's all you're trying to do, there's no need to actually check the OS.
This is not an easy thing to answer with any degree of certainty as there are very few ports that will always be open on one OS but not on another.
You could try some/all of the following
80 http obviously
22,23 Telnet and SSH (Not usually open on windows, one at least usually open on *nix)
135 Used by WMI so often open on windows
1443 (Possibly SQL Server)
691 Used by MS Exchange routing
3389 MS Remote Desktop
I would suggest that scanning ranges of ports may lead you into trouble particularly if these are not your machines. You may find your IP address logged as a possible source of "Port Scanners"
There are some fairly extensive lists of ports available on the web. e.g. http://keir.net/portlist.html

Resources