Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import fabric
- from fabric.api import env, sudo, local, settings
- import config
- env.user = 'root'
- env.host_string = '94.177.252.78'
- env.password = config.senha_sudo
- def useradd(nome, senha):
- env.password = config.senha_sudo
- resultado = sudo("useradd -M -s /bin/false {0}".format(nome), quiet=True)
- if not resultado.failed:
- sudo("(echo {0} ; echo {0} ) | passwd {1}".format(senha, nome), quiet=True)
- return True
- else:
- return False
Add Comment
Please, Sign In to add comment