O'Reilly logo

Linux Shell Scripting Cookbook by Sarath Lakshman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

User administration script

GNU/Linux is a multi user operating system. Many users can log in and perform several activities at a time. There are several administration tasks that are handled with user management. The tasks includes setting the default shell for the user, disabling a user account, disabling a shell account, adding new users, removing users, setting a password, setting an expiry date for a user account, and so on. This recipe aims at writing a user management tool that can handle all of these tasks.

How to do it…

Let's go through the user administration script:

#!/bin/bash #Filename: user_adm.sh #Description: A user administration tool function usage() { echo Usage: echo Add a new user echo $0 -adduser username password echo echo Remove ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required