Make FreeRDP prompt user for username and password?

The trick is putting the password switch at the end of your command line so that you can leave it blank. This will trigger xfreerdp to prompt your for the password instead of having to provide it via the command line.

Example

new cli interface (v1.1+)
$ xfreerdp /v:farm.company.com /d:company.com /u:oshiro /g:rds.company.com /p
old cli interface (v1.0.2)
$ xfreerdp -u oshiro -d company.com farm.company.com -t 3389 -p

NOTE: The new CLI is available in the pre-releases, v1.1+, so pay special attention to which version you're using. Running the command xfreerdp --version will show you which. Also take a look at the releases topic in the wiki for more information on each.

Sample connection

Here's an example of me connecting to a RDP server.

$ xfreerdp --ignore-certificate -u smingolelli -d mydom -t 5000 rdp.mydom.com -p
connected to rdp.mydom.com:5000
Password: 

Prompting the user

This issue in the FreeRDP issue tracker titled: Prompt for Credentials - NLA #1512, had this snippet of how you could use zenity to prompt the user for a username and password using GUI dialogs and then run xfreerdp with the provided info afterwards.

$ xfreerdp /v:yourRDSfarmFQDN \
/u:$(zenity \
--entry \
--title="Domain Username" \
--text="Enter your Username") \
/p:$(zenity \
--entry \
--title="Domain Password" \
--text="Enter your _password:" \
--hide-text) \
/d:yourdomainname \
/f \
/cert-ignore
+clipboard

The above when executed would pop these dialogs up to the user. These will come up one at a time in turn.

                   ss #1         ss #2

References

  • Commnad Line Interfaces - FreeRDP Wiki

I'd like to expand on slm's solution. I wanted a single window to enter all information in and allow me to specify a RemoteApp all in one go, so I built on what he suggested with zenity and created this.

XFreeRDP Prompt

XFreeRDP-Prompt

Code:

#!/bin/bash

# XFreeRDP RemoteApp W/ Prompt Script
# Version 0.3
# Description:
# XFreeRDP Remote App Script utilizing Zentity to populate variables
# Written by Jarrett Higgins 12-2015

OUTPUT=$(zenity --forms --title="Connection Information" \
    --text="Enter information about your Remote Connection" \
    --separator="," \
    --add-entry="Server" \
    --add-entry="Port (Default: 3389)" \
    --add-entry="Domain (Optional)" \
    --add-entry="Username" \
    --add-password="Password" \
    --add-entry="Remote App Name (Optional)")
OUTPUT_RESULTS=$?
if ((OUTPUT_RESULTS != 0)); then
    echo "something went wrong"
    exit 1
fi
Blank=""
Server=$(awk -F, '{print $1}' <<<$OUTPUT)
Port=$(awk -F, '{print $2}' <<<$OUTPUT)
if ["$Port" = "$Blank"]
then
    Port="3389"
else
    Port="$Port"
fi
Domain=$(awk -F, '{print $3}' <<<$OUTPUT)
Username=$(awk -F, '{print $4}' <<<$OUTPUT)
Password=$(awk -F, '{print $5}' <<<$OUTPUT)
App=$(awk -F, '{print $6}' <<<$OUTPUT)
if ["$App" = "$Blank"]
then
    App="$App"
    Title="$Server"
else
    AppName="$App"
    Title="$AppName on $Server"
    App="/app:||$App"
fi
#zenity --info --title="Information Return" --text="$Server $Port $Domain $Username $Password $App"
xfreerdp /t:"$Title" /v:$Server:$Port /d:$Domain /u:$Username /p:$Password $App /cert-ignore /workarea +clipboard
Password=""

Features:

  • Defaults to port 3389 if not populated
  • Defaults to no Remote App if not populated

Planned:

  • Security Certificate Warning
  • RDWeb Query to provide Resource List

I use this on my #!++ laptop with great success for connecting to my company and VM Remote Apps and client Servers. I'm not experienced with scripting, so if anyone has any suggestions or feedback, I would love to hear them.


If you specify tls security, the remote computer will prompt for password:

Xfreerdp --sec tls

The new parameter format:

  /sec:tls