summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--user_mgr.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/user_mgr.cpp b/user_mgr.cpp
index ebed493..f407133 100644
--- a/user_mgr.cpp
+++ b/user_mgr.cpp
@@ -274,7 +274,7 @@ void UserMgr::createUser(std::string userName,
try
{
executeCmd("/usr/sbin/useradd", userName.c_str(), "-G", groups.c_str(),
- "-M", "-N", "-s",
+ "-m", "-N", "-s",
(sshRequested ? "/bin/sh" : "/bin/nologin"), "-e",
(enabled ? "" : "1970-01-02"));
}
@@ -303,7 +303,7 @@ void UserMgr::deleteUser(std::string userName)
throwForUserDoesNotExist(userName);
try
{
- executeCmd("/usr/sbin/userdel", userName.c_str());
+ executeCmd("/usr/sbin/userdel", userName.c_str(), "-r");
}
catch (const InternalFailure &e)
{
@@ -329,8 +329,9 @@ void UserMgr::renameUser(std::string userName, std::string newUserName)
usersList[userName].get()->userGroups());
try
{
+ std::string newHomeDir = "/home/" + newUserName;
executeCmd("/usr/sbin/usermod", "-l", newUserName.c_str(),
- userName.c_str());
+ userName.c_str(), "-d", newHomeDir.c_str(), "-m");
}
catch (const InternalFailure &e)
{
OpenPOWER on IntegriCloud