Quantcast
Channel: Cemetech
Viewing all articles
Browse latest Browse all 75390

General Programming :: New User Script has Issues

$
0
0
Author: pcb_master
Subject: New User Script has Issues
Posted: 13 Oct 2012 11:29:19 am (GMT -5)

I have an ssh server that has a user named newuser. When bash starts, I run this Lua script.


Code:

log = io.open("/etc/.users_created", "W")

os.execute("clear")
print("Welcome to Closet Server!")
print("------------------------------")
io.write("What's your full name? (Type n! is you don't want to): ")
fullName = io.read()
io.write("What will your login be?: ")
login = io.read()
io.write("What will your password be?: ")
passwd = io.read("*")
io.write("One more thing. Who is Brett's favorite pokemon?: ")
verify = io.read()
if string.lower(verify) == "*" then
 print()
 print("Okay! Please wait, we are creating your account")
 os.execute([[sudo useradd ]] ..login.. [[ -p ]] ..password.. [[ -m]])
 log.write([[Full Name: ]] ..fullName.. [[/nUser: ]] ..login.. [[/nPasswd: ]] ..passwd.. [[/n/n]])
 print("You are now a user on Closet Server! Press enter to logout.")
 io.read()
else
 print()
 print("You did not verify correctly.")
 print("GTFO.")
 print("Press enter to logout.")
 io.read()
end
os.execute("exit")


Don't worry about the verify == "*". I just blocked out the verification keyword. Anyways, the error I get is:

Code:

lua: newuser_script:11: bad argument #1 to `read' (invalid format)
stack traceback:
        [C]: in function `read'
        newuser_script:11: in main chunk
        [C]: ?


What's up with that?


Viewing all articles
Browse latest Browse all 75390

Trending Articles