Automating VNC authorization process through command line

16,192

Solution 1

Assuming (by the tags) that you are using the vncviewer program from the command-prompt i think you could do something like this:

echo "password" | vncviewer -autopass host:display

using your example: vnc://172.16.41.101&passwd=test

echo "test" | vncviewer -autopass 172.16.41.101

Solution 2

If your vncviewer does not have the -autopass option, you can use vncpasswd to generate a password file that can be passed into the -passwd option:

vncviewer -passwd <(vncpasswd -f <<<"password") host:display
Share:
16,192
Arihant Nahata
Author by

Arihant Nahata

Updated on June 17, 2022

Comments

  • Arihant Nahata
    Arihant Nahata almost 2 years

    I am receiving a input as vnc://172.16.41.101&passwd=test

    What i want to do with this input is :
    1. Extract the IP address.
    2. Extract the password.
    3. Launch vncviewer with the ip and password provided.
    4. All this should this be automated, once the input is received.

    extracting the ip and password is easy. then i launch the vncviewer with the ip provided, but how do i pass the password to that without prompting the user for the password ?