I have this overriden in custom.lua:
Code
function LC.users.addUser(user, group, home, shell)
LC.log.print(LC.log.INFO, "Adding system account '", user, "'")
if shell == "sh" then
shell = "/bin/bash"
elseif shell == "scponly" then
if LC.fs.is_file("/usr/bin/rssh") then
shell = "/usr/bin/rssh"
else
shell = "/usr/bin/scponly"
end
elseif shell == "nologin" then
if LC.fs.is_file("/sbin/nologin") then
shell = "/sbin/nologin"
else
shell = "/usr/sbin/nologin"
end
else
shell = "/bin/false"
end
if LC.distribution.family == "Debian" then
useradd = "/usr/sbin/useradd -m -d " .. home .. " -g " .. group .. " " .. "-s " .. shell .. " " .. user
elseif LC.distribution.family == "SunOS" then
useradd = "useradd -m -d " .. home .. " -g " .. group .. " " .. "-s " .. shell .. " " .. user
elseif LC.distribution.family == "RedHat" then
useradd = "/usr/sbin/useradd -m -d " .. home .. " -M -g " .. group .. " " .. "-s " .. shell .. " " .. user
elseif LC.distribution.family == "SUSE" then
useradd = "useradd -m -d " .. home .. " -g " .. group .. " " .. "-s " .. shell .. " " .. user
elseif LC.distribution.family == "BSD" then
useradd = "pw useradd " .. user .. "-m -d " .. home .. " -g" .. group .. " -s" .. shell .. " -c ''"
elseif LC.distribution.family == "Gentoo" then
useradd = "/usr/sbin/useradd -m -d " .. home .. " -g " .. group .. " " .. "-s " .. shell .. " " .. user
end
local rc = LC.exec(useradd)
if rc ~= 0 then
return false, "Error while adding user '" .. user .. "' (exit code: " .. rc .. ")"
end
if LC.hooks then
LC.hooks.check("LC.users.addUser", user, group, home, shell)
end
return true
end
Alles anzeigen
Could you please add this feature to users.lua in a next release? It is very useful because it will allow us administrators to use the /etc/skel to set some desired defaults, like relocating the HOME to priv etc.
Thank you!