Modifying a User

Modifying a User


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.


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 the O’Reilly learning platform.

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