Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import os
- import random
- username = raw_input("user name? >>")
- cmd = "useradd -s /sbin/nologin " + username
- os.system(cmd)
- length = random.randint(8, 12)
- chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890%/'
- newpass = ""
- for i in range(1, length):
- newpass = newpass + random.choice(chars)
- print "youcan use this string to new password."
- print newpass
- cmd = "passwd " + username
- os.system(cmd)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement