您需要使用任何脚本生成vnc密码(最好使用php,但任何perl都可以)。
问题是'vncpasswd'需要交互式用户操作(提示输入密码和密码验证)。
是否有一种无需提示即可生成它的方法?
来自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";
是的,文件夹/.vnc
必须存在,并且通常必须设置文件权限。
所以就这样做:
mkdir $HOME/.vnc/
vncpasswd -f > $HOME/.vnc/passwd <<EOF
123456
123456
EOF
chmod 600 $HOME/.vnc/passwd