If the security solution fails, system administrator will use the script to automate the distribution of the SSH keys for all the machines in the network and will allow the administrator to SSH -t thoroughly the specific machine accompanied by the root permissions. System administrator can use the following commands to ensure the security of the system, until the monitoring solution will back in busniess.
$ ssh -t hostname top -U [username]
$ ssh -t hostname ps -u [username]
$ ssh -t hostname watch w
$ ssh -t hostname watch w [username]
$ ssh -t hostname watch who
$ ssh -t hostname watch who -a
$ ssh -t hostname watch users
$ ssh -t hostname tail -f /var/log/syslog
$ ssh -t hostname htop
The code is to automate sending the ssh public ID to many machines, and if user need to access the machines it could be easy, cause the code will add all the required information to .ssh/config.
- Install git into you Machine to pull and push from the server.
- Install gedit text editor.
- Make the file executable
- Send commands direct to other machines using the command The following commands
$ sudo apt-get install git
$ sudo apt-get install gedit
$ chmod +x auto-ssh.py
$ ssh -t machine-name (The command here)
- Clone to the this repository from terminal
$ git clone https://github.com/mohanad86/autossh-python
$ git pull
$ cd autossh-python
-
Fourth how to add many machine using Python
Author: Mohanad Aly
Licensed under the Apache License