Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The acctmgr script is used to:
- * report on commonly requested user configurations.
- * perform common user account tasks.
- The script suports four reporting options:
- --reportnopassword : Shows a list of all user accounts without a password set. All found accounts are locked.
- --reportexpired : Show all expired accounts.
- --reportexpiration : Show expiration date/time for all accounts.
- --reportnoexpire : Show all accounts with no expiration date.
- Additionally, the script supports four different acounts that can be taken on user accounts:
- --unlock : Unlocks a user account. Pass the username with the --username parameter (see examples below).
- --lock : Lock a user account. Pass the username with the --username parameter (see examples below).
- --useradd : Creates a new user account. Will prompt for details if none are defined.
- --username : Defines the username for the new user account.
- --userhome : Defines the home for the new user account.
- --userfull : Defines the full name of the user account.
- --userpass : Defines the default password for the new user account.
- --userexpire : Defines the expiration date for the account in YYYY-MM-DD format.
- --useraddfile : Defines the path to a file that contains accounts to add in user:home:name:password:expiration format.
- --setexpiration : Set the expiration date on an account. Pass username with --username and date with --userexpir parameters.
- The following common parameters can be issued as well;
- --help : Displays a quick reference to the commands available.
- --log : Defines the path to log output of the script to.
- Restrictions & Guidance:
- * You may run as many reports in a single request as desired.
- * Only one user action may be taken request.
- * You may not run a user action and a report in the same request.
- * If you define a log file, any existing log file by the same name will be overwritten.
- Examples:
- The following examples assume that you have set U+X with chmod on the script and that
- you have permissions to run the script with sudo.
- ## Runas all available reports in one command.
- ./acctmgr.sh --reportnopassword --reportexpired --reportexpiration --reportnoexpire
- ## Runs the report of accounts that do not expire and logs into file.
- ./acctmgr.sh --reportnoexpire --log nonexpiring.log
- ## Locks a given user account named 'linuxtest'
- ./acctmgr.sh --lock --username linuxtest
- ## Unlocks a given user account named 'linuxtest'
- ./acctmgr.sh --unlock --username linuxtest
- ## Sets the expiration date on account 'linuxtest' to 2020-12-31
- ./acctmgr.sh --setexpiration --username linuxtest --userexpire 2020-12-31
- ## Create a new user named mylinuxguy with defined properties.
- ./acctmgr.sh --useradd --username mylinuxguy --userhome /home/mylinuxguy --userfull "My linux Guy!!" --userpass "N0n0FUrBiz" --userexpire 2020-12-31
- ## Creates a list of new users using the (included) acctmgr.USERSAMPLE file
- ./acctmgr.sh --useradd --useraddfile acctmgr.USERSAMPLE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement