You are not logged in.
I am looking to setup some computers as thinclients to connect to my MS Terminal Servers. We have a homebrew application that configures RDP sessions. A user logs into a webpage that dynamically generates a "launch.rdp" file. This file is generated to balance the load between servers.
What I'd like to do is configure an image to boot up into Mozilla. When the user goes to the webpage, I'd like the launch.rdp file to open up in a terminal server session.
I've tried with rdesktop and tsclient, but unfortunately neither would work with a "rdp" file. Any help or suggestions are appreciated. Thanks!
Offline
I was pretty sure the last time I tried tsclient it did work with .rdp files. Doing a quick google search shows that it should still be the case. Maybe you're doing it wrong?
Offline
Very possible. What I did to install tsclient was build it using http://aur.archlinux.org/packages.php?ID=24074. When I open the .rdp file, I choose to open it with /usr/bin/tsclient. When I do that, it opens up the tsclient gui instead of the actual rdp connection. Any ideas as to what I can do?
Offline
Oh right. I opened the rdp from tsclient. I'm not sure if you can use xdg-open to open the file the way you are.
Offline
So are there any options? I refuse to believe that this isn't possible with Linux.
Offline
Offline
That's a good idea. The way it works now is a Solaris server checks our MS Terminal Server resources, and dynamically generated an .rdp file for the server with the most available resources. I'll get with our vendor to see if they have the capability to create an RDP session for rdesktop.
Offline
I'm playing around with it now, and just wanted to see if you had any suggestions. Here's what I have on my webserver:
launch.sh
#!/bin/sh
/usr/bin/rdesktop -d DOMAIN -g 1024x768 172.16.10.117
When I click on the file from Firefox, I get an option to open the file or save it. I choose to open it with rdesktop, but unfortunately it doesn't open. Is there a better way of doing this?
Offline
I was thinking something more like...
#!/bin/bash
rdpfile="$1"
resolution=1024x768
server=$(grep "^full address" $rdpfile | cut -d: -f3)
domain=$(grep "^domain" $rdpfile | cut -d: -f3)
/usr/bin/rdesktop -d "$domain" -g "$resolution" "$server"
And then run that as: `parserdp rdpfile.rdp`.
Actually, you might be able to just open the .rdp file with this script...
Offline
Yeah being a noob I was trying to open it up with xterm and rdesktop directly. I choose "bash" in Firefox and it worked out great. Now if I can only convince my vendor to change their side we'll be in business. Thanks for the help all.
Offline
Actually moving further, do you know of a way to pull something out of the launch.rdp file? For example if I wanted to pull the address out of it and open it with a script would that be possible?
Offline
I made a little modification to the script you wrote:
#!/bin/bash
rdpfile="$1"
resolution=1024x768
server=$(cat launch.rdp | sed -n "21p" | sed 's/^.\{30\}//g')
/usr/bin/rdesktop -d Domain -g "$resolution" "$server"
With this it takes the downloaded launch.rdp file and strips out only the host address. It works if I just run the script by itself. However I need this to work when opening from Firefox; I.E when downloading the rdp file. Any ideas?
Last edited by goosed (2010-05-31 02:00:07)
Offline
Well... you could use the Preferences -> Application setting for .rdp files in Firefox to automatically use this script to open the file. (The easy way)
Or you could build a simple firefox addon that would accomplish it. (harder and a little less elegant, though with a lot of work, you might be able to get it to appear inside the browser. Cool looking and flashy, but it would likely be a little more taxing on the system.)
I keep getting distracted from my webserver project...
huh? oooh... shiny!
Offline
I made a little modification to the script you wrote:
#!/bin/bash rdpfile="$1" resolution=1024x768 server=$(cat launch.rdp | sed -n "21p" | sed 's/^.\{30\}//g') /usr/bin/rdesktop -d Domain -g "$resolution" "$server"
With this it takes the downloaded launch.rdp file and strips out only the host address. It works if I just run the script by itself. However I need this to work when opening from Firefox; I.E when downloading the rdp file. Any ideas?
This is bad, because it depends on the file providing the server on the 21st line and none other. I used grep and cut because it's a more general solution that holds to the format of the file. Of course, now that I think about it, awk is even better for this..
server=$(awk -F: '/^full address/{print $3}' "$rdpfile")
Offline
falconindy, when I run the script now with awk (./script.sh launch.rdp) I get cannot resolve host. What am I missing?
LeoSolaris, when I go to open the file in Firefox I choose "Open with..." and select the script. It unfortunately doesn't do anything. Weird because when I run it from the command line it does work.
Thanks again guys.
Offline
Here is what I'm running at the command line:
awk -F: '/^full address/{print $3}' "launch.rdp"
And there's no output.
Offline
Sure, here's what it contains:
screen mode id:i:2
desktopwidth:i:1280
desktopheight:i:1024
session bpp:i:24
winposstr:s:2,3,0,0,800,600
full address:s:172.16.0.117
compression:i:1
keyboardhook:i:2
audiomode:i:0
redirectdrives:i:1
redirectprinters:i:1
redirectcomports:i:0
redirectsmartcards:i:1
displayconnectionbar:i:1
autoreconnection enabled:i:1
username:s:User
domain:s:America
alternate shell:s:
shell working directory:s:
disable wallpaper:i:0
disable full window drag:i:0
disable menu anims:i:0
disable themes:i:0
disable cursor setting:i:0
bitmapcachepersistenable:i:1
Offline
Offline
What am I doing wrong here?? When I run the awk command from the shell I don't get any output. And my bad on the launch.rdp file. Here is what it contains exactly:
screen mode id:i:2
use multimon:i:0
desktopwidth:i:1280
desktopheight:i:1024
session bpp:i:16
winposstr:s:0,3,1462,116,2486,854
compression:i:1
keyboardhook:i:2
audiocapturemode:i:0
videoplaybackmode:i:1
connection type:i:2
displayconnectionbar:i:1
disable wallpaper:i:1
allow font smoothing:i:0
allow desktop composition:i:0
disable full window drag:i:1
disable menu anims:i:1
disable themes:i:0
disable cursor setting:i:0
bitmapcachepersistenable:i:1
full address:s:192.168.10.105
audiomode:i:0
redirectprinters:i:1
redirectcomports:i:0
redirectsmartcards:i:1
redirectclipboard:i:1
redirectposdevices:i:0
redirectdirectx:i:1
autoreconnection enabled:i:1
authentication level:i:2
enablecredsspsupport:i:0
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
alternate shell:s:
shell working directory:s:
gatewayhostname:s:
gatewayusagemethod:i:4
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
promptcredentialonce:i:1
use redirection server name:i:0
Offline
When I try the awk command on the initial file it does work correctly. Why doesn't it work for the newer one?
Sorry for the confusion, and thank you for your patience.
Last edited by goosed (2010-06-01 17:56:22)
Offline
likely you've got CRLF issues.
awk -F ':' '/^full address/ {print $3}' test.rdp
192.168.10.105
do yourself a favor and copy paste the more recent rdp file into a fresh linux file and try again (vim also has a conversion command but i can never remember it).
Last edited by brisbin33 (2010-06-01 18:12:44)
//github/
Offline
awk does what it advertises on this file too... not sure what you're doing wrong. This is an Arch box with gawk, right?
try sed:
sed -n '/^full address/s/.*:\(.*\)$/\1/p' launch.rdp
or grep...
grep -oE '[[:digit:]]+.[[:digit:]]+.[[:digit:]]+\.[[:digit:]]+' launch.rdp
or pure Bash!
while read line; do
try=${line##*:};
[[ $try =~ [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ ]] && echo $try
done < launch.rdp
Overboard:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FULLADDRESS "full address:s:"
int main(void) {
char *buffer;
FILE *fd;
buffer = calloc(1, BUFSIZ);
fd = fopen("launch.rdp", "r");
if (!fd)
exit(EXIT_FAILURE);
while (fgets(buffer, BUFSIZ, fd))
if (strstr(buffer, FULLADDRESS)) {
printf("%s", buffer + strlen(FULLADDRESS));
break;
}
free(buffer);
fclose(fd);
return 0;
}
edit: i need more sleep... brisbin's probably onto something...
Last edited by falconindy (2010-06-01 18:36:59)
Offline
Thank you for all the replies and suggestions guys! Much appreciated.
Offline