Question: Overview Study the Fabric API run(), sudo(), local(), and put() and utilize them to create four new Fabric tasks called: addUser(username) findUser(username) listUser() listSysUser() The

Overview

Study the Fabric API run(), sudo(), local(), and put() and utilize them to create four new Fabric tasks called:

  • addUser(username)
  • findUser(username)
  • listUser()
  • listSysUser()

The addUser(username) task should perform the following operations on a remote system:

  • make a new user when necessary information is provided, and if the user name is already exist, the operation should fail.

The findUser(username) task should perform the following operations on a remote system:

  • scan the appropriate file(s) on the remote system and determine whether the named user exist or not and report accordingly.

The listUser() task should perform the following operations on a remote system:

  • scan the appropriate file(s) on the remote system and produce a list of shell user names on the system. Shell users are those users who can login to the remote system and get a bash shell.

The listSysUser() task should perform the following operations on a remote system:

  • scan the appropriate file(s) on the remote system and produce a list of system user (non-shell) name on the system. System users are those users who will not get a bash shell.
  • Use the following to template for your script
from fabric.api import * env.user = "student" def addUser(name): '''add a user with given user name to remote system''' ... def listUser(): '''return a list of shell user on a remote system''' ... def listSysUser(): '''return a list of system (non-shell) user''' ... def findUser(name): '''find user with a given user name''' ... 

The addUser(username) task should perform the following operations on a remote system: make a new user when necessary information is provided, and if the user name is already exist, the operation should fail. The findUser(username) task should perform the following operations on a remote system: scan the appropriate file(s) on the remote system and determine whether the named user exist or not and report accordingly. The listUser() task should perform the following operations on a remote system: scan the appropriate file(s) on the remote system and produce a list of shell user names on the system. Shell users are those users who can login to the remote system and get a bash shell. The listSysUser() task should perform the following operations on a remote system: scan the appropriate file(s) on the remote system and produce a list of system user (non-shell) name on the system. System users are those users who will not get a bash shell.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!