Modifying a User

Modifying a User

modUser.rb

If you have ever administered a computer system that had multiple users, chances are you have had to modify existing accounts. In my experience, user accounts can be modified to update an expiration date, change a home directory, tweak a username, or, more commonly, to add a new group to the mix. Below you will find a generic script for guiding the user through the modification process. Keep in mind that this script needs to be run with elevated permissions.

Warning

This script is platform dependent, so ensure that your systems are compatible with the commands to avoid corrupting your user files.

The Code

 #!/usr/bin/env ruby #Using the command 'useradd' with various arguments print "Enter the username to ...

Get Wicked Cool Ruby Scripts now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.