Lines Matching full:pwd

196 local function adduser(pwd)
197 if (type(pwd) ~= "table") then
206 local f = io.popen(cmd .. " usershow " .. shell_escape(pwd.name) .. " -7 2> /dev/null")
212 if not pwd.gecos then
213 pwd.gecos = pwd.name .. " User"
215 if not pwd.homedir then
216 pwd.homedir = "/home/" .. pwd.name
219 if pwd.groups then
220 local list = splitlist(pwd.groups)
236 if pwd.primary_group and pwd.primary_group ~= pwd.name then
237 extraargs = extraargs .. " -g " .. shell_escape(pwd.primary_group)
239 if not pwd.no_create_home then
242 if not pwd.shell then
243 pwd.shell = "/bin/sh"
248 if pwd.passwd then
249 input = pwd.passwd
251 elseif pwd.plain_text_passwd then
252 input = pwd.plain_text_passwd
259 cmd = cmd .. "useradd -n " .. shell_escape(pwd.name) .. " -M 0755 -w none "
260 cmd = cmd .. extraargs .. " -c " .. shell_escape(pwd.gecos)
261 cmd = cmd .. " -d " .. shell_escape(pwd.homedir) .. " -s " .. shell_escape(pwd.shell) .. postcmd
269 warnmsg("fail to add user " .. pwd.name)
273 if pwd.locked then
278 cmd = cmd .. "lock " .. shell_escape(pwd.name)
281 return pwd.homedir
360 local function adddoas(pwd)
387 if type(pwd.doas) == "string" then
388 local rule = pwd.doas
389 rule = rule:gsub("%%u", pwd.name)
391 elseif type(pwd.doas) == "table" then
392 for _, str in ipairs(pwd.doas) do
394 rule = rule:gsub("%%u", pwd.name)
407 local function addsudo(pwd)
434 if type(pwd.sudo) == "string" then
435 f:write(pwd.name .. " " .. pwd.sudo .. "\n")
436 elseif type(pwd.sudo) == "table" then
437 for _, str in ipairs(pwd.sudo) do
438 f:write(pwd.name .. " " .. str .. "\n")