https://github.com/xinlin-z/autopass
Entering password automatically for sudo, ssh, scp, like sshpass.
https://github.com/xinlin-z/autopass
password python scp ssh sshpass sudo
Last synced: 2 months ago
JSON representation
Entering password automatically for sudo, ssh, scp, like sshpass.
- Host: GitHub
- URL: https://github.com/xinlin-z/autopass
- Owner: xinlin-z
- License: mit
- Created: 2022-07-30T08:52:00.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-07T02:18:36.000Z (9 months ago)
- Last Synced: 2025-07-25T23:43:17.638Z (3 months ago)
- Topics: password, python, scp, ssh, sshpass, sudo
- Language: Python
- Homepage:
- Size: 60.5 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Autopass
* [Installation](#Installation)
* [Usage](#Usage)
Entering password automatically for sudo, ssh (remote command) and scp,
like sshpass. However, autopass is a pure Python version script.
**No third party module is needed!**
## Installation
```shell
$ pip install autopass
```
## Usage
``` shell
$ python -m autopass -p'passwd' sudo
$ AUTOPASS='passwd' python -m autopass [-t] ssh user@domain [-p port]
```
`-p`, specify the password.
`-t`, specify a timeout in seconds. SIGKILL will be issued to
child process after timeout. No timeout by default.
**Password would be issued only once and only in the first line of output
for security reason**. So if the password is not correct,
the child process will wait for a long time. This is your chance to
set a timeout. Other cases such as a
terrible network, an unknown host or the fingerprint of host is not right,
etc, might also need a timeout to prevent from waiting too long.
You can always place a
relatively large timeout
value to keep you from waiting like forever.
Password can also be taken from `AUTOPASS` environment variable.
But the password specified by `-p` has priority.
``` shell
$ export AUTOPASS='passwd'
$ python -m autopass
```
Autopass is a simple tool only for command execution, locally or remotely.
It cannot
be used interactively. And please do not start a background process by
autopass, like `-f` option of ssh. It is an error. But you definitely
could run autopass with command as a whole in background (by `&`).
Exit code of the executed command is returned properly, you can
use `echo $?` in your shell script to check if the command execution
is successful.
Have fun... ^____^