文件操作 - chpass-wrapper.py
返回文件管理
返回主菜单
删除本文件
文件: /root/.local/share/Trash/files/roundcube/plugins/password/helpers/chpass-wrapper.py
编辑文件内容
#!/usr/bin/env python import sys import pwd import subprocess BLACKLIST = ( # add blacklisted users here #'user1', ) try: username, password = sys.stdin.readline().split(':', 1) except ValueError: sys.exit('Malformed input') try: user = pwd.getpwnam(username) except KeyError: sys.exit('No such user: %s' % username) if user.pw_uid < 1000: sys.exit('Changing the password for user id < 1000 is forbidden') if username in BLACKLIST: sys.exit('Changing password for user %s is forbidden (user blacklisted)' % username) handle = subprocess.Popen('/usr/sbin/chpasswd', stdin = subprocess.PIPE) handle.communicate('%s:%s' % (username, password)) sys.exit(handle.returncode)
修改文件时间
将文件时间修改为当前时间的前一年
删除文件