开发者

How to generate a VNC password?

开发者 https://www.devze.com 2022-12-08 23:49 出处:网络
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开发者_StackOverflow社

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开发者_StackOverflow社区 password verification).

Is there a way to generate it without prompting ?


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";


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号