Lines Matching refs:pwd
130 local function adduser(pwd)
131 if (type(pwd) ~= "table") then
140 local f = io.popen(cmd .. " usershow " .. pwd.name .. " -7 2> /dev/null")
146 if not pwd.gecos then
147 pwd.gecos = pwd.name .. " User"
149 if not pwd.homedir then
150 pwd.homedir = "/home/" .. pwd.name
153 if pwd.groups then
154 local list = splitlist(pwd.groups)
159 if pwd.primary_group and pwd.primary_group ~= pwd.name then
160 extraargs = extraargs .. " -g " .. pwd.primary_group
162 if not pwd.no_create_home then
165 if not pwd.shell then
166 pwd.shell = "/bin/sh"
171 if pwd.passwd then
172 input = pwd.passwd
174 elseif pwd.plain_text_passwd then
175 input = pwd.plain_text_passwd
182 cmd = cmd .. "useradd -n " .. pwd.name .. " -M 0755 -w none "
183 cmd = cmd .. extraargs .. " -c '" .. pwd.gecos
184 cmd = cmd .. "' -d '" .. pwd.homedir .. "' -s " .. pwd.shell .. postcmd
192 warnmsg("fail to add user " .. pwd.name)
196 if pwd.locked then
201 cmd = cmd .. "lock " .. pwd.name
204 return pwd.homedir
279 local function addsudo(pwd)
305 if type(pwd.sudo) == "string" then
306 f:write(pwd.name .. " " .. pwd.sudo .. "\n")
307 elseif type(pwd.sudo) == "table" then
308 for _, str in ipairs(pwd.sudo) do
309 f:write(pwd.name .. " " .. str .. "\n")