diff --git a/account/newuser.in b/account/newuser.in
index 0f2fe61270228af78505d2da83d8bf5961bfb605..82c3cba1af6478159f22c4ca43b91dddf025a62e 100644
--- a/account/newuser.in
+++ b/account/newuser.in
@@ -442,7 +442,7 @@ sub escapeshellarg($)
 {
     my ($str) = @_;
 
-    $str =~ s/(')/'\\''/g;
+    $str =~ s/[^[:alnum:]]/\\$&/g;
     return $str;
 }