Initial commit
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
From 3862ecd0e0d99c9591b036e6e53d84113eb24752 Mon Sep 17 00:00:00 2001
|
||||
From: "Chen.Zhao" <zhao.chen@luxshare-ict.com>
|
||||
Date: Wed, 11 Dec 2024 17:42:00 +0800
|
||||
Subject: [PATCH] Do not remove user home dir when delete user
|
||||
|
||||
---
|
||||
user_mgr.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/user_mgr.cpp b/user_mgr.cpp
|
||||
index 873ee1d..257fbe9 100644
|
||||
--- a/user_mgr.cpp
|
||||
+++ b/user_mgr.cpp
|
||||
@@ -1617,7 +1617,7 @@ void UserMgr::executeUserAdd(const char* userName, const char* groups,
|
||||
|
||||
void UserMgr::executeUserDelete(const char* userName)
|
||||
{
|
||||
- executeCmd("/usr/sbin/userdel", userName, "-r");
|
||||
+ executeCmd("/usr/sbin/userdel", userName);
|
||||
}
|
||||
|
||||
void UserMgr::executeUserClearFailRecords(const char* userName)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
From b814451f0d9301d3ad9210154512cbee4eaaac9b Mon Sep 17 00:00:00 2001
|
||||
From: "Chen.Zhao" <zhao.chen@luxshare-ict.com>
|
||||
Date: Tue, 10 Dec 2024 15:30:10 +0800
|
||||
Subject: [PATCH] Move user home to tmp instead
|
||||
|
||||
When creat new user or modify user name, because the user HOME is default in /home, BMC can't move
|
||||
/home/xxx to another folder. So move user HOME to /tmp to fix this issue.
|
||||
Tested:
|
||||
D:\Software\ipmitool_win_18>ipmitool -I lanplus -H 10.67.13.44 -U test -P Admin@9000 user set name 2 testtest
|
||||
|
||||
D:\Software\ipmitool_win_18>ipmitool -I lanplus -H 10.67.13.44 -U test -P Admin@9000 user list 1
|
||||
ID Name Callin Link Auth IPMI Msg Channel Priv Limit
|
||||
1 root false true true ADMINISTRATOR
|
||||
2 testtest false true true ADMINISTRATOR
|
||||
3 test false true true ADMINISTRATOR
|
||||
4 true false false NO ACCESS
|
||||
5 true false false NO ACCESS
|
||||
6 true false false NO ACCESS
|
||||
7 true false false NO ACCESS
|
||||
8 true false false NO ACCESS
|
||||
9 true false false NO ACCESS
|
||||
10 true false false NO ACCESS
|
||||
11 true false false NO ACCESS
|
||||
12 true false false NO ACCESS
|
||||
13 true false false NO ACCESS
|
||||
14 true false false NO ACCESS
|
||||
15 true false false NO ACCESS
|
||||
---
|
||||
user_mgr.cpp | 12 +++++++-----
|
||||
1 file changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/user_mgr.cpp b/user_mgr.cpp
|
||||
index 5bb1509..873ee1d 100644
|
||||
--- a/user_mgr.cpp
|
||||
+++ b/user_mgr.cpp
|
||||
@@ -1609,9 +1609,10 @@ void UserMgr::executeUserAdd(const char* userName, const char* groups,
|
||||
{
|
||||
// set EXPIRE_DATE to 0 to disable user, PAM takes 0 as expire on
|
||||
// 1970-01-01, that's an implementation-defined behavior
|
||||
- executeCmd("/usr/sbin/useradd", userName, "-G", groups, "-m", "-N", "-s",
|
||||
- (sshRequested ? "/bin/sh" : "/sbin/nologin"), "-e",
|
||||
- (enabled ? "" : "1970-01-01"));
|
||||
+ executeCmd("/usr/sbin/useradd", userName, "-G", groups, "-M", "-d", "/tmp",
|
||||
+ "-N", "-s", (sshRequested ? "/bin/sh" : "/sbin/nologin"), "-e",
|
||||
+ (enabled ? "" : "1970-01-01"));
|
||||
+
|
||||
}
|
||||
|
||||
void UserMgr::executeUserDelete(const char* userName)
|
||||
@@ -1628,8 +1629,9 @@ void UserMgr::executeUserRename(const char* userName, const char* newUserName)
|
||||
{
|
||||
std::string newHomeDir = "/home/";
|
||||
newHomeDir += newUserName;
|
||||
- executeCmd("/usr/sbin/usermod", "-l", newUserName, userName, "-d",
|
||||
- newHomeDir.c_str(), "-m");
|
||||
+ // Do not create new home, and re-use /tmp as home for the user
|
||||
+ executeCmd("/usr/sbin/usermod", "-l", newUserName, userName, "-d", "/tmp");
|
||||
+
|
||||
}
|
||||
|
||||
void UserMgr::executeUserModify(const char* userName, const char* newGroups,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://0001-Move-user-home-to-tmp-instead.patch \
|
||||
file://0001-Do-not-remove-user-home-dir-when-delete-user.patch \
|
||||
"
|
||||
Reference in New Issue
Block a user