made newer installer that does not require tar stuff
This commit is contained in:
1
prod/hysh/bin/su
Normal file
1
prod/hysh/bin/su
Normal file
@@ -0,0 +1 @@
|
||||
local a=({...})[1]local b=syscall.getuid()if syscall.geteuid()~=0 then syscall.exec("/bin/su",{...})end;local c;if a then c=syscall.getuidbyname(a)else c=0 end;if not c then print("su: user '"..a.."' does not exist")syscall.exit(1)return end;if b~=0 then printInline("Password: ")local d=""while true do local e=syscall.read(0)if not e or e==""then elseif e=="\n"then syscall.write(1,"\n")break elseif e=="\b"then if#d>0 then d=d:sub(1,-2)syscall.write(1,"\b \b")end else d=d..e;syscall.write(1,"*")end end;local f,g=syscall.login(c,d)if not f then sleep(1)print("su: Authentication failure")syscall.exit(1)return end else syscall.setuid(c)end;local h=syscall.getpasswd(c)local i=h and h.shell or"/bin/hysh"local j=h and h.homedir or"/"local k=h and h.username or"Unknown"local l,m=pcall(syscall.chdir,j)if not l then j="/"syscall.chdir(j)end;syscall.setEnviron("HOME",j)syscall.setEnviron("USER",k)syscall.setEnviron("SHELL",i)local f,g=pcall(syscall.exec,i)if not f then print("su: cannot exec shell '"..i.."': "..tostring(g))syscall.exit(1)end
|
||||
Reference in New Issue
Block a user