[K12OSN] Scripting for Linux - RDesktop straight to an app

Peter Scheie peter at scheie.homedns.org
Wed Apr 25 17:02:20 UTC 2007

Roger wrote:
> On 4/24/07, Kemp, Levi <lnkemp at bolivar.k12.mo.us> wrote:
>> Here's is my current situation, we want to use rdesktop to a terminal 
>> server for a couple legacy apps. I've seen you can pass the user name 
>> and password with -u and -p command line or enter them in using the 
>> TSClient. In the TSClient you can also specify an app to open right 
>> away, how would you do this on the command line? And if I were to 
>> script this, which I'm familiar with only in windows right now, how 
>> might I go about using the current users username and password to fill 
>> the arguments? We are authenticating to the windows AD so the username 
>> and password for the terminal server would be the same. This way I can 
>> create links on the students desktops to the program and it would log 
>> them into the terminal server and open the app, creating the illusion 
>> they are running it local if it is done full screen. Any thoughts on 
>> this, it is my first time scripting in Linux. I created what I thought 
>> was a script, but it always asks me if I want to Run, View, or Run in 
>> Terminal, and I
>  can't have it do that. It works like I want it, except I had to put in 
> the username/password manually, and still open the app. Thanks for the 
> help once again!
> Do you have the script so that you can run it from the command line?
> After that, you may need to create a launcher to be able to just
> double click on an icon.
> Normally, if it's a shell script, you can access the current name with 
> $USER.
> So, with a bash script, you would put:
> rdesktop -u $USER  'server-name'
> To start an app, for instance Firefox, you'd have to specify the full
> path to the executable on the command line:
> rdesktop -u $USER -s "c:\program files\mozilla firefox\firefox.exe"
> server-name
> Not sure if you can take the password they've entered and add it to
> the command line.  I think the command line would want the plain text
> password.
You could write a wrapper script that prompts the user for the password, then passes 
that pw to the rdesktop command.  I like using zenity for creating GUI prompts to users 
(see the man page).  So you could do something like this:

PW=`zenity --entry --hide-text --text="Please enter your password"`
rdesktop -u $USER -p  $PW 'server-name'

Put the above lines into a file in. say, /usr/local/bin, make it executable (chmod +x 
script), and try it from a command line.  If that works, then do as Roger suggested and 
create a launcher that calls the script.


More information about the K12OSN mailing list