User Tools

Site Tools


unix:osx:rdesktop_script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
unix:osx:rdesktop_script [2010/03/04 17:46]
ben
unix:osx:rdesktop_script [2010/03/05 02:55] (current)
ben
Line 5: Line 5:
 Passwords can be stored as generic password types, the biggest caveat is that the format domain\username cannot be easily used.  Username@domain can however, so store your account information in that format. Passwords can be stored as generic password types, the biggest caveat is that the format domain\username cannot be easily used.  Username@domain can however, so store your account information in that format.
  
-Once passwords are loaded into Keychain, they can be retrieved in command line scripts via the security command. ​ For example:+Once passwords are loaded into Keychain, they can be retrieved in command line scripts via the security command. The output of passwords is on stderr, the output of other information is on stdout.  ​So there'​s a little redirection that needs to happen to keep things tidy. For example:
 <​code>​ <​code>​
 security 2>&1 >&- find-generic-password -l $username -g CUIT.keychain security 2>&1 >&- find-generic-password -l $username -g CUIT.keychain
Line 11: Line 11:
 </​code>​ </​code>​
  
-The first gets the password for the keychain element with the name $username, and the second gets the account ​stored in the same one.+The first gets the password for the keychain element with the name $username, and the second gets the account.
  
-The rest of the script just runs through command line arguments and runs the rdesktop command with each host.  It's fairly straight forward.+The rest of the script just runs through command line arguments and executes ​the rdesktop command with each host.  It's fairly straight forward.
  
-The nice thing is that it can be aliased in your .profile to various account names. ​ E.g.: alias rda1.sh='​rd.sh acct1@blah.domain'​+The nice thing is that it can be aliased in your .profile to various account names. ​ E.g.:<​code> ​alias rda1.sh='​rd.sh acct1@blah.domain'​</​code>​
  
 Here's the script: Here's the script:
Line 31: Line 31:
 pass=$(echo $passline|grep -e ^password:) pass=$(echo $passline|grep -e ^password:)
  
-#If the last command ​was NOT successful (security outputs the password as stderr!) +#Depending on the success of the last command, we either output an error, or 
-#then get the password via a cut and the account name via a grep and cut+#get the password via a cut and the account name via a grep and cut
 if (( $? )) if (( $? ))
  then   then 
unix/osx/rdesktop_script.1267742807.txt.gz · Last modified: 2010/03/04 17:46 by ben