If I run adduser testuser from the terminal the command asks me some questions like for a password. But this code:
import os
a = os.system('useradd testuser')
exist with error code 0 (no problem there). But it don’t asks any question. Why is that? And how can I work around it. I also tried subprocess which did the same thing.
This is because
adduseranduseraddare two different programs. The former asks interactive questions, the latter doesn’t. If you want the interactive prompts, calladduser, and usesubprocess.call()to do so.