Skip to content

Commit cb85a7a

Browse files
Use single-quotes for escaping (#12)
bash is otherwise interpreting '$' as variables in encrypted password hash
1 parent 5d41e86 commit cb85a7a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ES.SFTP.Host/Business/Security/UserUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static async Task UserSetPassword(string username, string password, bool
3535
await ProcessUtil.QuickRun("usermod", $"-p \"*\" {username}");
3636
else
3737
await ProcessUtil.QuickRun("bash",
38-
$"-c \"echo \\\"{username}:{password}\\\" | chpasswd {(passwordIsEncrypted ? "-e" : string.Empty)} \"");
38+
$"-c \"echo '{username}:{password}' | chpasswd {(passwordIsEncrypted ? "-e" : string.Empty)}\"");
3939
}
4040

4141
public static async Task<int> UserGetId(string username)

0 commit comments

Comments
 (0)