From cc6f68b974e5a7e2222b59308c33f3af6bac4245 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Wed, 14 Dec 2022 15:36:59 +0000 Subject: [PATCH] Improve error message when `passwd `file has a bad permission --- unix/vncserver/vncserver.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unix/vncserver/vncserver.in b/unix/vncserver/vncserver.in index 91b0f162..95d672b1 100755 --- a/unix/vncserver/vncserver.in +++ b/unix/vncserver/vncserver.in @@ -150,8 +150,10 @@ if ($config{'password'} || if ((!$securityTypeArgSpecified || $vncAuthEnabled) && !$passwordArgSpecified) { ($z,$z,$mode) = stat("$vncUserDir/passwd"); - if (!(-e "$vncUserDir/passwd") || ($mode & 077)) { + if (! -e "$vncUserDir/passwd") { die "VNC authentication enabled, but no password file created.\n"; + } elsif ($mode & 077) { + die "$vncUserDir/passwd must NOT be accessible by others. Set permission to 0600.\n"; } } -- 2.39.5