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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started