{ "info": { "author": "bugnofree", "author_email": "pwnkeeper@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# sshmgr - A powerful Linux server manager\n\nIt leverages docker to automatically do\n\n- create a new ubuntu container for user, the current supported ubuntu base images are\n - ubuntu 16.04\n- setup a default password located in user's `$HOME/.defpsd`\n- setup a ssh login welcome message\n\nIt supports `docker` for normal docker creation and `nvidia-docker` for gpu docker creation.\nThe dockerfile for nvidia based gpu could be found here\n@[https://gitlab.com/nvidia/cuda].\n\nYou can specify a customized `dockerfile` with first line beginning with `FROM ubuntu:`.\n\n# Dependencies\n\n- Server Side\n - The Linux server should have docker installed\n- Client Side\n - The client should have `~/.ssh/config` configured\n - The client should have `paramiko` package installed\n\n# Installation\n\nDownload the source, uncompress it and enter the source directory. Run the following command to install\n\n pip3 install sshmgr\n\n# Quick start\n\n## Main interface\n\n \u279c sshmgr (master) \u2717 sshmgr -h\n usage: sshmgr [-h] [-v] [--hosts [hosts]] [--sshkey path_of_the_new_ssh_key]\n {docker} ...\n\n A powerful linux server manager\n\n positional arguments:\n {docker}\n\n optional arguments:\n -h, --help show this help message and exit\n -v, --version Show the version of sshmgr\n --hosts [hosts] The host(s) to be operated on\n --sshkey path_of_the_new_ssh_key\n Update ssh key for administrator\n\nMore about `--hosts`. You can process multiple hosts in one command, if the\nhost name\n\n- case that beginning with `@`\n\n It indicates a file that contains multiple host ID, one ID holds one line.\n For example, `@$HOME/Downloads/hostids`.\n\n Empty lines will be ignored and lines begin with `#` will be regarded as\n comments.\n\n- case that beginning with `/`\n\n The hosts are seperated by comma, for example `/tom, nancy, louis`.\n\n- case that a normal host\n\n A single host name you want to connect to.\n\n## The docker interface\n\n sshmgr --hosts docker [-h]\n (--new username | --delete username | --query username | --list)\n [--fdocker dockerfile] [--nvidia]\n [--apt {ubuntu.16.04.offical,ubuntu.16.04.tsinghua}]\n [--himsg hello_message]\n\n optional arguments:\n -h, --help show this help message and exit\n --new username The user to add\n --delete username The user to delete\n --query username Query the information of username\n --list List all users in the host.\n --fdocker dockerfile The file path to dockerfile, the first line of the\n file must be `FROM ubuntu:16.04`\n --nvidia Enable gpu based nvidia docker\n --apt {ubuntu.16.04.offical,ubuntu.16.04.tsinghua}\n Select apt source.list, the default is\n ubuntu.16.04.offical\n --himsg hello_message\n Messages showed after your guest logined into the\n server\n\nsshmgr will connect to your specified host and create a docker container for\nyour guest, create a `$HOME/share` folder shared between the user on host and the\nuser on the container.\n\n## The info interface\n\nRetrieve server information:\n\n sshmger --hosts info [-h]\n [--net Network]\n [--factory Manufacturer]\n [--cpu CPU]\n [--mem Memory]\n [--disk Disk]\n\nAn example is showed as below:\n\n \"102\": {\n \"info\": {\n \"net\": {\n \"verbose\": [\n \"2: enp2s0f0: mtu 1500 qdisc mq state UP group default qlen 1000\\n\",\n \" inet 192.168.100.102/24 brd 192.168.100.255 scope global enp2s0f0\\n\"\n ]\n },\n \"factory\": {\n \"verbose\": [\n \"\\tManufacturer: xxx\\n\",\n \"\\tProduct Name: xxx V3\\n\",\n \"\\tSerial Number: xxx\\n\"\n ],\n \"Manufacturer\": \"xxx\",\n \"Product Name\": \"xxx V3\",\n \"Serial Number\": \"xxx\"\n },\n \"cpu\": {\n \"verbose\": [\n \"\\tSocket Designation: CPU01\\n\",\n \"\\tVersion: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz\\n\",\n \"\\tCore Count: 8\\n\",\n \"\\tThread Count: 16\\n\",\n \"\\tSocket Designation: CPU02\\n\",\n \"\\tVersion: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz\\n\",\n \"\\tCore Count: 8\\n\",\n \"\\tThread Count: 16\\n\"\n ],\n \"logic_core_count\": 32\n },\n \"mem\": {\n \"verbose\": [\n \" total used free shared buff/cache available\\n\",\n \"Mem: 131626576 577188 130605988 9304 443400 130449412\\n\",\n \"Swap: 133803004 0 133803004\\n\",\n \"\\tMaximum Capacity: 2 TB\\n\"\n ],\n \"total\": 131626576\n },\n \"disk\": {\n \"verbose\": [\n \"Disk /dev/sda: 1198GB\\n\"\n ],\n \"size\": 1286342705152\n }\n },\n \"errmsg\": null,\n \"status\": false\n }\n\nBoth memory and disk size are in bytes.\n\nIf you want to process further, for example, you want to have an overview of the\nservers in `cpu`, `memory`, `disk`, you can use the following code snippets:\n\n #! /usr/bin/env python3\n #! -*- coding:utf-8 -*-\n\n import json\n\n with open('sysinfo.json', 'r') as _:\n sysinfo = json.load(_)\n\n cpucnt, memsz, disksz = 0, 0, 0\n for host in sysinfo.keys():\n if not sysinfo[host]['islive']: continue\n cpucnt += sysinfo[host]['info']['cpu']['logic_core_count']\n memsz += sysinfo[host]['info']['mem']['total']\n disksz += sysinfo[host]['info']['disk']['size']\n\n print(f'[+] CPU Count: {cpucnt} Memory Size: {memsz/(1024 ** 3)} GB Disk Size: {disksz/(1024 ** 4)} TB')\n\n# Development\n\nOpen a terminal at the project root, debug with `python3 -m src `.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ikey4u/sshmgr", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "sshmgr", "package_url": "https://pypi.org/project/sshmgr/", "platform": "", "project_url": "https://pypi.org/project/sshmgr/", "project_urls": { "Homepage": "https://github.com/ikey4u/sshmgr" }, "release_url": "https://pypi.org/project/sshmgr/3.2.3/", "requires_dist": null, "requires_python": ">=3.6.0", "summary": "A powerful ssh manager", "version": "3.2.3" }, "last_serial": 5576018, "releases": { "3.2.0": [ { "comment_text": "", "digests": { "md5": "167bbcba2f9c37bd4e692fd5ee7aed03", "sha256": "d993617f7ae0d716c56973fe51889c6b7d08eb2cf6880c08ecb2ee2847ec0b9f" }, "downloads": -1, "filename": "sshmgr-3.2.0.tar.gz", "has_sig": false, "md5_digest": "167bbcba2f9c37bd4e692fd5ee7aed03", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 23268, "upload_time": "2019-06-12T18:11:43", "url": "https://files.pythonhosted.org/packages/41/09/1ab4945e61c9eb29652122bb667b0e3dbcd26e2734be49990214f6de94b4/sshmgr-3.2.0.tar.gz" } ], "3.2.1": [ { "comment_text": "", "digests": { "md5": "fe984d8575ef99fc0f97e9f6ea95268b", "sha256": "37ad74b26666b4a30ba71026399aec57be57ebcc0822d4441a2c107d818e5764" }, "downloads": -1, "filename": "sshmgr-3.2.1.tar.gz", "has_sig": false, "md5_digest": "fe984d8575ef99fc0f97e9f6ea95268b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 23187, "upload_time": "2019-06-12T18:16:33", "url": "https://files.pythonhosted.org/packages/74/ab/7d0046592a54d7fcea264d9e6d291c6389a6a9c5cbb8e5c577706e004f17/sshmgr-3.2.1.tar.gz" } ], "3.2.2": [ { "comment_text": "", "digests": { "md5": "69dff3e760861a88f17712d07d80be96", "sha256": "d4aeb811e7fcf896a1aeb43d6ec5d39cf8c2ff3265c3fde428906f36a1b78255" }, "downloads": -1, "filename": "sshmgr-3.2.2.tar.gz", "has_sig": false, "md5_digest": "69dff3e760861a88f17712d07d80be96", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 26966, "upload_time": "2019-07-24T05:27:01", "url": "https://files.pythonhosted.org/packages/9f/45/9653c0846c7bacf44002095e717dc8199242ef8ccf0c6c2d4c02f8f5d50a/sshmgr-3.2.2.tar.gz" } ], "3.2.3": [ { "comment_text": "", "digests": { "md5": "bca811c4024e46f258432c0a88a11450", "sha256": "c21d03db413229cc82b9b83f1b498ba02fd43b49758388667552843781cdb705" }, "downloads": -1, "filename": "sshmgr-3.2.3.tar.gz", "has_sig": false, "md5_digest": "bca811c4024e46f258432c0a88a11450", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 28378, "upload_time": "2019-07-24T06:06:06", "url": "https://files.pythonhosted.org/packages/2e/87/e0689316c8fe606a92a9edceef640a0e9192512ea5bf24837fc7ad3072f9/sshmgr-3.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bca811c4024e46f258432c0a88a11450", "sha256": "c21d03db413229cc82b9b83f1b498ba02fd43b49758388667552843781cdb705" }, "downloads": -1, "filename": "sshmgr-3.2.3.tar.gz", "has_sig": false, "md5_digest": "bca811c4024e46f258432c0a88a11450", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 28378, "upload_time": "2019-07-24T06:06:06", "url": "https://files.pythonhosted.org/packages/2e/87/e0689316c8fe606a92a9edceef640a0e9192512ea5bf24837fc7ad3072f9/sshmgr-3.2.3.tar.gz" } ] }