Giter Club home page Giter Club logo

getlinuxuserlocation's Introduction

getLinuxUserLocation

Using this project you may check location of each user which is connected to your Linux server.

How to start

  1. Get project:
$ git clone https://github.com/mperov/getLinuxUserLocation.git
$ cd getLinuxUserLocation/
  1. Create special Python virtual enviroment by
$ sudo apt-get install python3-venv -y
$ python3 -m venv getLinuxUserLocation
$ source getLinuxUserLocation/bin/activate
  1. Next install some Python modules - pip3 install -r requirements or python3 -m pip install -r requirements
    If you don't have pip3 then you may install it how described here
  2. Generate public and private ssh keys without password via ssh-keygen -t rsa
  3. Add public key to remote server using ssh-copy-id -i ~/.ssh/id_rsa.pub -p SSH_PORT YOUR_USER_NAME@IP_ADDRESS_OF_THE_SERVER
  4. On remote machine change /etc/sudoers file to run sudo commands without password. For it /etc/sudoers should contain line like this coder ALL=(ALL:ALL) NOPASSWD: ALL
  5. Copy script whereFrom to remote server to /opt/ directory, e.g. scp -p 22 ./ubuntu/whereFrom [email protected]:/opt/whereFrom.
    In this project there are some files whereFrom, for Ubuntu, CentOS and for openVPN server. Choose your variante.

Usage

  1. Load virtual enviroment
$ source getLinuxUserLocation/bin/activate
  1. Get location list
$ ./getLocation.py -hi 192.168.1.5 -u coder -p 10028 -k /home/coder/.ssh/id_rsa -o

option -o means that remote server has old operating system, e.g. CentOS 7.9

By the way, there is help output:

$ ./getLocation.py -h
usage: getLocation.py [-h] [-hi HOSTIP] [-p PORT] [-u USER] [-k KEY] [-d] [-o]

optional arguments:
  -h, --help            show this help message and exit
  -hi HOSTIP, --hostIP HOSTIP
                        contain IP address your server
  -p PORT, --port PORT  contain ssh port
  -u USER, --user USER  contain username with sudo rules
  -k KEY, --private-key KEY
                        contain path to private key file
  -d, --debug           this option enables debug mode
  -o, --old             this option for old Linux distributions

getlinuxuserlocation's People

Contributors

mperov avatar

Watchers

 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.