Automating VNC authorization process through command line

Arihant Nahata picture Arihant Nahata · Feb 16, 2011 · Viewed 13.8k times · Source

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 ?

Answer

Bruno Flávio picture Bruno Flávio · Aug 5, 2011

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