Python判断Linux用户是否存在

import pwd
usernames = [x[0] for x in pwd.getpwall()]
if 'nginx' in usernames:
    print("nginx")

  

posted @ 2022-09-19 21:50  lucky_tomato  阅读(183)  评论(0编辑  收藏  举报