I have a shell script on a Unix box which when executed sets the DISPLAY variable dynamicaly to the clients ip address and if the client has some sort of x windows up and running then it launches say a program ike xcalc.
I would want the shell script to launch the x windows say like exceed session on the winodws client when the shell script is executed is this possible if so how ?
regards
Edwards
The general answer to that is "no, not unless you explicitly enable it."
Think about this in a general sense. Your questions is "Is my PC security so weak that external computers can connect in start programs on it, without a password or certificate?"
Clearly this effectively would mean that your PC had zero security. So for your sake, I sincerely hope that the answer to your question is "No".
If in your case the answer is "Yes", then perhaps it's time to abandon Windows 98?
This might be something worth asking on ServerFault too, since it's somewhat of a gray area between programming and system administration.
Are clients logged in via a shell to the server? Rather than setting the DISPLAY variable to their IP address, I highly recommend using SSH and some sort of client (openssh on Linux, PuTTY on Windows) that will automagically set the DISPLAY variable when you login.
The procedure would look like this:
Start an X server the client (eXceed, Xorg, etc)
Use PuTTY/SSH to login to the server with X11 forwarding turned on (-X for openssh, Connection | SSH | X11 for PuTTY)
Start the X11 program
The nice thing about this setup is that it's easy to tell if the client has an X server running - the DISPLAY variable will be set if so, but unset if not.
You say that you want to start a session on the Windows client when they login - do you want to see, for example, a login similar to what you would see if you were at the machine? In that case, you might want to use XDMCP.
Related
I have been tasked to block our openvpn access to specific devices using MAC address, It seems possible to do this with the openvpn access server but i'm using the community edition, would there be a way to perform this task?
or would there be any suggestions on how to do it using a different method?
This can be done on the community addition with the client-connect cmd, but it is necessary for the client to have push-peer-info in the local vpn config. That will force the client to report the MAC address of its default gateway to the environment variable IV_HWADDR on the OpenVPN server. The script can then retrieve that value and compare it to a list of authorized MAC addresses in whatever language and manner you see fit. To allow the connection your script needs to exit with a value of 0, conversely to drop the connection it needs to exit with any non-zero number.
I'm trying to create a powershell script to start and authenticate an RDP session to multiple machines by IP range.
I'm very new to powershell, and windows/domain scripting in general.
I have written a powershell script using Connect-Mstsc that allows me to enter my username and password, as well as an IP range and it works, opens a session to all machines in the range and uses the credentials to authenticate me to connect to the machines.
My issue is, I'd like this script to perform LOCAL authentication on the machines as well, right now, when it runs, if I give it a range of say, 5 IP addresses, it opens 5 RDP sessions to the machines, which is good, but each session is sitting there at the login prompt. I would like it to automatically log me in on each machine locally using the same user/password I supply, and then hopefully execute a batch file from a network share on login.
I've done quite a bit of research on this, and I've come up empty, and given my beginner experience level I'm not sure I'm even looking in the right places.
I'm trying to set up an automated script from the Windows terminal that gets started from a Linux machine. The guys in my IT department have already set up a virtual SSH server on those Windows machines but they say they can't set a passwordless SSH to due to security reasons.
So I guess my question is two-fold:
1.) Is there something similar I can set up on these Windows machines that will allow me to connect to them through a Linux terminal that won't require a password and won't be a security issue.
2.) Can I still set up an automated script that will simply input the required password the second I'm prompted for a password?
Thanks for the help, guys. I just joined this site so apologies if I'm not clear or don't understand the etiquette yet.
This is my situation:
I have a linux server/media center with a windows client.
My goal is to remote control rhythmbox amongst other things.
I've done this using plink (windows based cli ssh toy).
The problem is that starting up an ssh session logging in and sending a command is understandably slow as hell. When I had a windows server I used a tool called psexec which was almost instantaneous.
Is there any way to speed this process up? Either somehow sending the commands with the login request which should show some improvement. Or by maintaining a persistent ssh connection which I can use. (plink dcs at the end of the command).
More info: On my windows machine I'm using a bat like:
plink -ssh -l username -pw pass myipaddress "/home/username/bin/skip"
On my linux machine the skip bash file is something like:
//needed to get around a x11 error caused by controlling rhythmbox over sshif its an ssh connection copy the dbusaddressfirhythmbox-client --next //the cli wrapper for rhythmbox
Further Research:
The only way to go seems to keep an ssh connection open/maintained as a service. This seems doable as there is a demand due to setting up ssh tunnels (to bypass firewalls). From there I'd need a way to send the command line commands to this existing connection or reuse that connection.
The other option is of course to NOT use ssh. Hell I already have a connection through samba file shares and there is no lag there. I bet I could put a service linux side that checks for a modified file. Then have an ap client side that modifies said file. Amazingly hacky but so far it seems like the best option. And by best I mean the only one that cuts control lag. There has got to be a better way than this, I can't be the only nerd using linux as a media-center that wants remote controls. This kind of moves the topic from stackoverflow to superuser but that's ok.
You could user an SSL certificate to get rid of the login part. Alternatively, build yourself a small HTTP server which uses an "exotic" port for controlling your media player (amarok, btw, has one build-in)
Switching to something like mpd will bypass the ssh issue, although I give no guarantee that changing tracks will be any faster.
If anyone is curious, I ended up implementing an http based server with php to execute commands server side. And client side I used curl.exe to allow me to have nice click-able buttons without the overhead of a web-browser.
Also nice since it allowed me to implement an in browser UI which is great to use from any machine with internet, ones that don't have ssh installed. And works wonderfully from my phone as a remote control (which I can use from a country away if I so chose...)
Maybe not the best worded question, but hopefully it's a straightforward problem.
The scenario is SSHing from a personal account on box A to a generic account on box B. The script running on box B needs to capture the personal account name for logging purposes. Is there any way of capturing this, either via SSH itself or some information captured by the shell? We are using ssh2 (Reflections), and KornShell (ksh) on Solaris.
If you have full control of the client machine, you can deploy identd to get the username.
Full procedure to get name from script:
Walk up process tree, find sshd
Walk netstat -p to find the remote IP and port.
Connect to client on port 113 and ask.
You may have to disable privilege separation for this to work as-is; however it should be trivial to modify to work w/o it.
You can't log the remote username reliably
You can log the IP of the connection (see the SSH_CONNECTION variable)
You could have a standard where they use an alias for ssh that logs the remote username as part of the login process, or where they store their username in a .ssh/environment file (but allowing environments to be set may require ssh/sshd config changes).
alias sshblah='ssh blah "REMOTEUSER=$USER; bash'
(Except that doesn't work, and I haven't tried to figure out why - and it would be different if you use tcsh, etc).
You can use environment passing in this manner, and select which variables you allow to be set. You'd have to get the users to set some alternate to $USER, like $REMOTE_USER=$USER, and then allow $REMOTE_USER to pass through. And you're trusting they don't set it incorrectly, or forget to set it (you can handle that case with a little annoyance by modifying this mechanism).
Note that you almost have to trust the client connecting to tell you who the user is - you can make it hard/annoying to spoof the username, but unless you use per-user certificates instead of a generic login/password they all know, you can't verify who connected.