debian - Set up TightVNC programmatically with BASH -


i'm writing script set vnc (amongst other things) on many debian based devices. want include vnc in setup (specifically, tightvnc if possible) , have set given password (randomly generated script). problem is, every guide find seems assume human doing this, , ready sit , type in password , press enter. can't seem bash echo password vnc (it says 'password short') nor can 'expect' work properly.

an example guide found looks this: http://www.penguintutor.com/linux/tightvnc

i'm looking similar this:

#!/bin/bash echo "going configure vnc" #turn on vnc server tightvncserver #spit out password vnc server first run echo $password #confirm pw echo $password 

but, on every virginal run of tightvncserver asks password inputted hand:

going configure vnc  require password access desktops.  password: password short 

how can #1 around this, or #2 use bash / expect give password make happy?

# configure vnc password umask 0077                                        # use safe default permissions mkdir -p "$home/.vnc"                             # create config directory chmod go-rwx "$home/.vnc"                         # enforce safe permissions vncpasswd -f <<<"$password" >"$home/.vnc/passwd"  # generate , write password 

modify taste, if packaging tightvnc uses location other ~/.vnc/ passwd file.


if have separate view-only , full-control passwords, then:

vncpasswd -f <<<"$full_password"$'\n'"$view_password" >"$home/.vnc/passwd" 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -