I currently have the following script which works fine:

user="$(zenity --entry --title="Username" --text="Username")"
pass="$(zenity --password --title="Password" --text="Password")"

xfreerdp /cert-ignore /f /v:farm.company.com /d:company.com /g:rds.company.com /u:${user} /gd:company.com /gu:${user} /gp:${pass} /p:${pass}

This is apparently not very secure as the username and password can easily be seen by using ps axu Is there a more secure way of creating this script?

  • This would be easier to answer if you explained exactly what your script is doing. Presumably xfreerdp is some kind of RDP client that connects to Windows machines but does it have any other ways of getting its password?
    – terdon
    Jul 15 '14 at 11:25
  • Its recommended to keep the /p argument blank so that the user gets prompted for the password when attempting to log in. Not sure if your use case would want the user to know the password though. Jul 15 '14 at 11:46
  • Simply put everything into a file with an appropriate umask and call xfreerdp /path/to/file
    – Dani_l
    Jul 15 '14 at 14:53
  • @Dani_l I converted your answer to a comment as you requested but why not flesh it out, explain what should go into the file and what permissions the file should have and post a proper answer?
    – terdon
    Jul 15 '14 at 16:00
  • 1
    The more popular rdesktop application (Debian PopCon has 56k installs for rdesktop vs 14k for freerdp-x11), which (from what I can tell) does the same thing as xfreerdp, can prompt you for passwords interactively on its own. Additionally, it supports -p - which would let you pipe the password from your second zenity command.
    – Adam Katz
    Feb 19 '15 at 0:25

It's impossible with xfreerdp according to its man page. If you insist on using it, you can use gdb to adjust the argv[] array after breaking the execution in main().

Or you can mount your /proc with hidepid=2 option in Linux, so no one will be able to see your processes except you and root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.