This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
FREAX/bin/userdel

27 lines
617 B
Text
Raw Normal View History

2022-07-18 19:33:40 +02:00
local tArgs = { ... }
if #tArgs < 1 then
kerneldraw.printAppInfo( "userdel", "Specify a user" )
return
end
if not security.getSU() or tArgs[1] == "root" then
exception.throw("RestrictedOpsException")
return
end
local pathA = "/etc/passwd/"..tArgs[1]..".dat"
local pathB = "/etc/passwd/.shadow/"..tArgs[1]..".usr"
local pathC = "/home/"..tArgs[1]
if fs.exists(pathA) then
if kerneldraw.request("remove user record") then
fs.delete( pathA )
if fs.exists(pathB) then
fs.delete( pathB )
end
fs.delete( pathC )
end
else
kerneldraw.printAppInfo("userdel", "User " .. tArgs[1] .. " does not exist")
end