2

This question already has an answer here:

I got a very simple alias on my bash:

alias xfreerdpp='xfreerdp /v:ip_address /u:username /d:domain /p:password /size:1024x768 /clipboard /cert-ignore &'

All I want to do is to make the ip_address a variable so that I can type xfreerdpp xxx.xxx.xxx.xxx, passing ip_address as an argument.

marked as duplicate by glenn jackman, cuonglm, Ramesh, jimmij, G-Man Jul 28 '15 at 0:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

You can add the following to your ~/.bashrc and source it then.

xfreerdpp() {
    xfreerdp /v:$1 /u:username /d:domain /p:password /size:1024x768 /clipboard /cert-ignore &
}

To execute: xfreerdpp xxx.xxx.xxx.xxx

Please also consider the security concern raised by @Nasha too.

In order to pass the password as an argument you can do:

xfreerdpp() {
    xfreerdp /v:$1 /u:username /d:domain /p:$2 /size:1024x768 /clipboard /cert-ignore &
}

And then execute: xfreerdpp xxx.xxx.xxx.xxx password

  • Thanks @Neuron. But where what would the $1 and $2 variables be? – rhittmann Jul 27 '15 at 18:29
  • xfreerdpp xxx.xxx.xxx.xxx password $1 = xxx.xxx.xxx.xxx $2 = password – neuron Jul 28 '15 at 8:40
0

I would personally drop the ampersand otherwise you'd need a script or a shell function. Over too complicated for a start. Here you go:

alias xfreerdpp='/usr/bin/xfreerdp \
    /u:username /d:domain /p:password \
    /size:1024x768 /clipboard /cert-ignore'

Invocation:

xfreerdp /v:345.16.54.12 &

(I know about the 345 in IP addresses, I watched «The Net» with Sandra Bullock ;-) )

Joke aside, just be aware that storing a password in clear form as an alias is a security breach in itself. Prefer manual authentication.

  • It worked perfectly. Tyvm @Nasha. I'm aware of the security risk, the problem is that sometimes, people sit with me to troubleshoot and i'm not comfortable typing my pw with them looking. – rhittmann Jul 27 '15 at 18:28

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