0

I am installating tightvnc server on my ubuntu machine by using ruby script my script contain following:

#!/usr/bin/ruby env    
`sudo apt-get --force-yes -y install tightvncserver`
`printf "%s\n%s\n" "demo123" "demo123" | vncserver :1`

I used printf way because vncserver ask for password on terminal, But that way failed, Is their any better way to solve this?

Pradeep Gupta
  • 397
  • 1
  • 5
  • 17

1 Answers1

-1

You'd want to use vncpassword to create a password file:

Step 2. Create a vnc password file with “vncpassword”.

$ vncpasswd
Using password file /home/user/.vnc/passwd
VNC directory /home/user/.vnc does not exist, creating.
Password: [TYPE YOUR VNC PASSWORD HERE]
Verify: [TYPE YOUR VNC PASSWORD HERE]
Would you like to enter a view-only password (y/n)? n

and then use that file in your script:

#!/usr/bin/ruby env    
`sudo apt-get --force-yes -y install tightvncserver`
`vncserver -p /home/user/.vnc/passwd`
Uri Agassi
  • 36,848
  • 14
  • 76
  • 93
  • 1
    This is interactive way to provide password using terminal , I already know this way, I wants to provide password using ruby script so that terminal not prompt and ask user to provide password.Hope this clear... – Pradeep Gupta Mar 25 '14 at 04:40