>>>>> "CBee" == Corn Beerse <Beerse> writes:

>> Here is roughly what I'm doing :
>> 
>> | #!/usr/local/bin/expect
>> |
>> | spawn su - $username -c "/path/to/vncserver"
>> | expect "Password: "
>> | send   "$password\r"

CBee> I know this will not work. The standard system call to ask for a
CBee> password is forced not to work from things like expect scripts. This is
CBee> an ongoing struggle between the 'get-password-system-call' and tools
CBee> like expect. Since the get-password-system-call is more close to the
CBee> system, it will win in most cases. I bet the next somehow works: Start
CBee> the expect sctipt and at the moment the password is asked, type the
CBee> password with the keyboard. I fond this working for several unix
CBee> variants.

Um...actually, this SHOULD work from expect as it's exactly along the lines of
what expect was written to do (and expect itself comes with several examples,
some of which actually use the 'su' command).

The main problem is that things like su open /dev/tty to get their input
instead of merely using stdin.  But expect deals with this correctly by using
pseudo-tty's to run the spawned program in.

I just did the following expect script:

  spawn su - $user -c "/path/to/vncserver -nolisten local"
  expect "Password:"
  send "$pass\r"
  expect eof

and it worked fine for me here.  The only thing that messed it up was that my
.login file did some things that it shouldn't have (an eval `resize` and some
echo statements to change the xterm title bar) but when I removed those, it
worked without a hitch.

Chuck

-- 
Charles K. Hines   <[EMAIL PROTECTED]>   <[EMAIL PROTECTED]>
Principal Scientist at ReQuest Technologies Inc   (http://www.ReQuestTech.com/)

  "dis ting could have possabiwities if I put my twisted widdle mind to it!"
                                                        - Bugs Bunny
_______________________________________________
VNC-List mailing list
[EMAIL PROTECTED]
http://www.realvnc.com/mailman/listinfo/vnc-list

Reply via email to