Giter VIP home page Giter VIP logo

muldel's Introduction

MulDel

MulDel is a bash script to delete the user from multiple Linux hosts at once.

This is a Bash script that deletes a specified user from a list of servers. The script first defines a variable "file" that holds the file name of a text file containing a list of IP addresses or hostnames of the servers. The script then defines a variable "user" that holds the username of the user that will be deleted.

The script then uses a "for" loop to iterate over the contents of the "file" variable, which are the IP addresses or hostnames of the servers. For each server, the script uses the "ssh" command to connect to the server as the "root" user and run the command "userdel $user | rm -rvf /home/$user" to delete the specified user and remove the user's home directory.

The script then checks the exit status of the previous command using the "$?" variable, which returns 0 if the command was successful or non-zero if the command failed. If the command was successful, the script will print a message indicating that the user was deleted successfully from the server. If the command failed, the script will print an error message indicating that there was an error deleting the user from the server.

After iterating through all the servers in the text file, the script ends.

muldel's People

Contributors

prosaugat 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.