How to generate a VNC password?

半世苍凉 提交于 2021-02-01 05:10:05

问题


Hi need to generate a vnc password using any script (php preferably but any perl will do).

Problem is that 'vncpasswd' needs interactive user action (prompting for password and password verification).

Is there a way to generate it without prompting ?


回答1:


From here.

#!/bin/perl

use Crypt::CBC;

my $key = pack("C8", 23, 82, 107, 6, 35, 78, 88, 7);
$cipher = Crypt::CBC->new({
'key'=>$key, 'cipher'=>'DES', 'prepend_iv'=>0, 'regenerate_key'=>0
});

$ciphertext = $cipher->encrypt("This data is hush hush");
$plaintext = $cipher->decrypt($ciphertext);

print "Encrypted: $ciphertext\n";
print "Decrypted: $plaintext\n";



回答2:


Yes it's possible, folder /.vnc must exist and file rights have usually to be set.

So just do this:

mkdir $HOME/.vnc/

vncpasswd -f > $HOME/.vnc/passwd <<EOF
123456
123456
EOF

chmod 600 $HOME/.vnc/passwd


来源:https://stackoverflow.com/questions/1607830/how-to-generate-a-vnc-password

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!