Jonathan Brown | 13 Apr 00:18 2013
Picon

Custom login script user/pass variables and pyhoca-cli


Hello I have two versions of a script that log a thin client into an x2go server using a YAD graphical prompt which passes variables to pyhoca-cli.

The following works fine and logs you right in after entering AD username and pass:

-----------------------------
#!/bin/bash
while true; do
frmdata=$(yad --center --undecorated --image=/usr/share/wallpaper/sago-header-mod.jpg --image-on-top --button="gtk-ok:0" --title "Login to Sago Linux Terminal Server" --form --field="AD username" --field="Password:H")
frmusername=$(echo $frmdata | awk 'BEGIN {FS="|" } { print $1 }')
frmpassword=$(echo $frmdata | awk 'BEGIN {FS="|" } { print $2 }')
pyhoca-cli --server 10.0.201.242 -u $frmusername --password $frmpassword -c startkde --sound none --kbd-layout us --kbd-type pc105/us -g fullscreen --add-to-known-hosts
done
----------------------------------

However, this one, which adds a dropdown to choose a session, does not just log in, it asked for interactive login at the console.. I don't understand why this would be happening.  Any ideas?

-----------------------------------
#!/bin/bash

while true; do

data=$(yad --center --undecorated --image=/usr/share/wallpaper/sago-header-mod.jpg --image-on-top --button="gtk-ok:0" --title "Login to Sago Linux Terminal Server" --form --field="AD username" --field="Password:H" --field="Session:CB" "" "" "kde!gnome!cinnamon!xfce!lxde!fluxbox")

eval $(echo $data | awk 'BEGIN {FS="|" } { printf "user=%s\npass=%s\nsession=%s", $1, $2, $3 }')

case $session in
  kde) cmd="startkde" ;;
  gnome) cmd="gnome-session" ;;
  cinnamon) cmd="gnome-session-cinnamon2d" ;;
  xfce) cmd="startxfce4" ;;
  lxde) cmd="startlxde" ;;
  fluxbox) cmd="startfluxbox" ;;
esac

pyhoca-cli --server 10.0.201.242 -u $user --password $pass -c $cmd --sound none --kbd-layout us --kbd-type pc105/us -g fullscreen --add-to-known-hosts

done
-----------------------------------

The following shows the messages on the 2nd script when testing:

Xlib.protocol.request.QueryExtension
pyhoca-cli[2083] NOTICE: preparing requested X2Go session
pyhoca-cli[2083] (PyHocaCLI) NOTICE: preparing requested X2Go session
pyhoca-cli[2083] (x2gosessregistry-pylib) NOTICE: registering X2Go session Pyhoca-Client_Session...
pyhoca-cli[2083] (x2goclient-pylib) NOTICE: initializing X2Go session...
pyhoca-cli[2083] (x2gocontrolsession-pylib) NOTICE: connecting to [10.0.201.242]:22
pyhoca-cli[2083] (x2gosession-pylib) NOTICE: SSH host key verification for host [10.0.201.242]:22 with SSH-RSA fingerprint ,,7a:91:b6:50:99:3b:f3:61:86:7a:84:24:89:e1:6e:a6'' initiated. We are seeing this X2Go server for the first time.
pyhoca-cli[2083] (x2goclient-pylib) WARN: HOOK_check_host_dialog: host check requested for session profile Pyhoca-Client_Session: Automatically adding host [10.0.201.242]:22 with fingerprint: ,,7a:91:b6:50:99:3b:f3:61:86:7a:84:24:89:e1:6e:a6'' as a known host.
pyhoca-cli[2083] (x2gosession-pylib) NOTICE: SSH host key verification for host [10.0.201.242]:22 with SSH-RSA fingerprint ,,7a:91:b6:50:99:3b:f3:61:86:7a:84:24:89:e1:6e:a6'' initiated. We are seeing this X2Go server for the first time.
pyhoca-cli[2083] (x2goclient-pylib) WARN: HOOK_check_host_dialog: host check requested for session profile Pyhoca-Client_Session: Automatically adding host [10.0.201.242]:22 with fingerprint: ,,7a:91:b6:50:99:3b:f3:61:86:7a:84:24:89:e1:6e:a6'' as a known host.
pyhoca-cli[2083] (PyHocaCLI) NOTICE: interactive login for user ,,jgb3025''
Password:
--------------------------------------------------------

Thanks for any possible help on this!

--
"It is only when each individual has achieved inner peace that we will see lasting outer peace in the world"
<div><div dir="ltr">
<div><br></div>
<div>Hello I have two versions of a script that log a thin client into an x2go server using a YAD graphical prompt which passes variables to pyhoca-cli.</div>
<div><br></div>
<div>
The following works fine and logs you right in after entering AD username and pass:</div>
<div><br></div>
<div>-----------------------------</div>
<div>
<div>#!/bin/bash</div>
<div>while true; do</div>
<div>frmdata=$(yad --center --undecorated --image=/usr/share/wallpaper/sago-header-mod.jpg --image-on-top --button="gtk-ok:0" --title "Login to Sago Linux Terminal Server" --form --field="AD username" --field="Password:H")</div>
<div>frmusername=$(echo $frmdata | awk 'BEGIN {FS="|" } { print $1 }')</div>
<div>frmpassword=$(echo $frmdata | awk 'BEGIN {FS="|" } { print $2 }')</div>
<div>pyhoca-cli --server 10.0.201.242 -u $frmusername --password $frmpassword -c startkde --sound none --kbd-layout us --kbd-type pc105/us -g fullscreen --add-to-known-hosts</div>
<div>done</div>
</div>
<div>----------------------------------</div>
<div><br></div>
<div>However, this one, which adds a dropdown to choose a session, does not just log in, it asked for interactive login at the console.. I don't understand why this would be happening. &nbsp;Any ideas?</div>
<div><br></div>
<div>-----------------------------------</div>
<div>#!/bin/bash</div>
<div><br></div>
<div>while true; do</div>
<div><br></div>
<div>data=$(yad --center --undecorated --image=/usr/share/wallpaper/sago-header-mod.jpg --image-on-top --button="gtk-ok:0" --title "Login to Sago Linux Terminal Server" --form --field="AD username" --field="Password:H" --field="Session:CB" "" "" "kde!gnome!cinnamon!xfce!lxde!fluxbox")</div>
<div><br></div>
<div>eval $(echo $data | awk 'BEGIN {FS="|" } { printf "user=%s\npass=%s\nsession=%s", $1, $2, $3 }')</div>
<div><br></div>
<div>case $session in</div>
<div>&nbsp; kde) cmd="startkde" ;;</div>
<div>&nbsp; gnome) cmd="gnome-session" ;;</div>
<div>&nbsp; cinnamon) cmd="gnome-session-cinnamon2d" ;;</div>
<div>&nbsp; xfce) cmd="startxfce4" ;;</div>
<div>&nbsp; lxde) cmd="startlxde" ;;</div>
<div>&nbsp; fluxbox) cmd="startfluxbox" ;;</div>
<div>esac</div>
<div><br></div>
<div>pyhoca-cli --server 10.0.201.242 -u $user --password $pass -c $cmd --sound none --kbd-layout us --kbd-type pc105/us -g fullscreen --add-to-known-hosts</div>
<div><br></div>
<div>done</div>
<div>-----------------------------------</div>
<div><br></div>
<div>The following shows the messages on the 2nd script when testing:</div>
<div><br></div>
<div>
<div>Xlib.protocol.request.QueryExtension</div>
<div>pyhoca-cli[2083] NOTICE: preparing requested X2Go session</div>
<div>pyhoca-cli[2083] (PyHocaCLI) NOTICE: preparing requested X2Go session</div>
<div>pyhoca-cli[2083] (x2gosessregistry-pylib) NOTICE: registering X2Go session Pyhoca-Client_Session...</div>
<div>pyhoca-cli[2083] (x2goclient-pylib) NOTICE: initializing X2Go session...</div>
<div>pyhoca-cli[2083] (x2gocontrolsession-pylib) NOTICE: connecting to [10.0.201.242]:22</div>
<div>pyhoca-cli[2083] (x2gosession-pylib) NOTICE: SSH host key verification for host [10.0.201.242]:22 with SSH-RSA fingerprint ,,7a:91:b6:50:99:3b:f3:61:86:7a:84:24:89:e1:6e:a6'' initiated. We are seeing this X2Go server for the first time.</div>
<div>pyhoca-cli[2083] (x2goclient-pylib) WARN: HOOK_check_host_dialog: host check requested for session profile Pyhoca-Client_Session: Automatically adding host [10.0.201.242]:22 with fingerprint: ,,7a:91:b6:50:99:3b:f3:61:86:7a:84:24:89:e1:6e:a6'' as a known host.</div>
<div>pyhoca-cli[2083] (x2gosession-pylib) NOTICE: SSH host key verification for host [10.0.201.242]:22 with SSH-RSA fingerprint ,,7a:91:b6:50:99:3b:f3:61:86:7a:84:24:89:e1:6e:a6'' initiated. We are seeing this X2Go server for the first time.</div>
<div>pyhoca-cli[2083] (x2goclient-pylib) WARN: HOOK_check_host_dialog: host check requested for session profile Pyhoca-Client_Session: Automatically adding host [10.0.201.242]:22 with fingerprint: ,,7a:91:b6:50:99:3b:f3:61:86:7a:84:24:89:e1:6e:a6'' as a known host.</div>
<div>pyhoca-cli[2083] (PyHocaCLI) NOTICE: interactive login for user ,,jgb3025''</div>
<div>Password:</div>
</div>
<div>--------------------------------------------------------</div>
<div><br></div>
<div>Thanks for any possible help on this!</div>
<div><br></div>-- <br>"It is only when each individual has achieved inner peace that we will see lasting outer peace in the world" <br>
</div></div>

Gmane