Coder Social home page Coder Social logo

python-usermanagement's Introduction

python-usermanagement

Python Script to replace useradd and userdel command. 

HELP

  For Help type -> python3 user_management.py -h 
        usage: user_management.py [-h] [-a ADD-USER] [-d DELETE-USER] [-g group]
                      [-x gid] [-y uid] [-s shell] [-f directory]
                      [-p passwd]

        ADD/DELETE Users

        optional arguments:
        -h, --help                                  show this help message and exit
        -a ADD-USER, --add ADD-USER                 ADD USER TO THE SERVER
        -d DELETE-USER, --delete DELETE-USER        DELETE USER FROM THE THE SERVER
        -g group, --group group                     Manually specific USER GROUP
        -x gid, --gid gid                           Manually specific GROUP ID
        -y uid, --uid uid                           Manually specific USER ID
        -s shell, --shell shell                     USE NO to avoid login shell creation
        -f directory, --directory directory         USE NO to avoid USER directory creation
        -p passwd, --passwd passwd                  USE YES to overide default password created

SAMPLE - ADD_USER

  run -> python3 user_management.py -a test.user1 --gid 1003 --uid 1003 -p YES
  
  - To add user 'test.user1' use the above command
  - UID and GID are required and need to be unique;
  - if GID is not mentioned it defaults to UID value for creating group
  - GROUP NAME defaults user name; can be overridden using --group flag
  - -p flag can be used set unique password for user; script encodes the password and writes it to the shadow file
  - if -p flag is not set; the default password for the user created is 'passw0rd'
  - The default shell is bash; if shel  is not requrired use flag and value as -->>>  --shell NO
  - THe default home directory created is /home/<user_name> ; if default home directory is not required use flag --> --directory NO
  - Note: Script doesn't support user addition to existing GROUPS.

SAMPLE - DELETE_USER

   run -> python3 user_management.py -d "test.user1"
  
  - run the above command to delete user --> test.user1
   - Script will clean up home directory only if its created.

python-usermanagement's People

Contributors

kry496 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.