forked from team/makeuser
Add work
This commit is contained in:
parent
e05705d6c9
commit
e97a2b17f3
|
@ -0,0 +1,43 @@
|
|||
Subject: welcome to tilde.team!
|
||||
|
||||
hey ~newusername,
|
||||
|
||||
welcome to tilde.team!
|
||||
|
||||
your new account has been established. you can ssh into tilde.team with
|
||||
the ssh key you supplied on registration.
|
||||
|
||||
your password is "newpassword". please change it when you log in for
|
||||
the first time. the password is used for imap/smtp auth, not shell login,
|
||||
which is set to only use ssh key authentication.
|
||||
|
||||
to get started, type `motd` at the command prompt to see a few ways to
|
||||
get started. have fun!
|
||||
|
||||
the greatest value of tilde.team is not the services provided by the
|
||||
server, but rather the interesting and welcoming community built by its
|
||||
users. this is possible because of people like you who choose to make
|
||||
this a great place. the best way you can help tilde.team is by working
|
||||
to support a great system culture. chat on irc; build cool programs and
|
||||
share them with others; focus on learning, and help others learn; be a
|
||||
good example for others; have fun!
|
||||
|
||||
also, your ~/public_html directory is served at
|
||||
https://tilde.team/~newusername/
|
||||
(you can also use https://newusername.tilde.team)
|
||||
|
||||
check out our wiki at https://tilde.team/wiki/ for more information (and
|
||||
maybe help us write a new wiki article:)
|
||||
|
||||
our irc is tilde.chat, an irc network connecting several
|
||||
tilde servers. the `chat` command on your ~team shell will open up
|
||||
weechat with some nice default configs and plugins.
|
||||
see our wiki article (https://tilde.team/wiki/?page=irc)
|
||||
or https://tilde.chat site for information on how to connect from elsewhere.
|
||||
we also have a webclient at https://irc.tilde.team that you can
|
||||
register for by running the `webirc` command from a shell session.
|
||||
|
||||
we look forward to seeing you around! welcome to the ~team!
|
||||
|
||||
~tilde.team admins
|
||||
|
11
makeuser
11
makeuser
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os,argparse
|
||||
import subprocess,argparse,random,string
|
||||
from ctypes import cdll,c_char_p
|
||||
libc = cdll.LoadLibrary("libc.so.6")
|
||||
|
||||
parser = argparse.ArgumentParser(prog="makeuser",description="A user adding script.")
|
||||
parser.add_argument("username",help="Username of user.")
|
||||
|
@ -8,4 +10,9 @@ parser.add_argument("email",help="Email of user.")
|
|||
parser.add_argument("key",help="The user's SSH pubkey.")
|
||||
args = parser.parse_args()
|
||||
|
||||
print(args.username,args.email,args.key)
|
||||
pw = "".join(random.sample(string.ascii_letters+string.digits,20))
|
||||
cr = libc.crypt(pw)
|
||||
|
||||
subprocess.run("sudo useradd -m -g 100 -p {} -s /bin/bash {}".format(cr,args.user)
|
||||
subprocess.run("echo '{}' | sudo tee /home/{}/.ssh/authorized_keys".format(args.key,args.user))
|
||||
subprocess.run("sed -e 's/username/{}/' -e 's/password/{}/' email.tmpl | sendmail {} sudoers@tilde.team")
|
||||
|
|
Loading…
Reference in New Issue