fix: create linux user with home dir (#15670)

This commit is contained in:
zer0e 2024-03-05 11:30:23 +08:00 committed by GitHub
parent 04a6b0d281
commit 82ffdbfb30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -229,7 +229,7 @@ public class OSUtils {
*/
private static void createLinuxUser(String userName, String userGroup) throws IOException {
log.info("create linux os user: {}", userName);
String cmd = String.format("sudo useradd -g %s %s", userGroup, userName);
String cmd = String.format("sudo useradd -m -g %s %s", userGroup, userName);
log.info("execute cmd: {}", cmd);
exeCmd(cmd);
}