Skip to main content

Entering password automatically for sudo, ssh, scp

Project description

autopass

Entering password automatically for sudo, ssh (remote command) and scp, like sshpass. Autopass is a pure python version. For ssh, a yes confirmation is also issued automatically for you if necessary.

No third party module is needed! No need pexpect!

Installation

$ pip install autopass

Usage

$ python -m autopass -p'passwd' sudo <command>
$ AUTOPASS='passwd' python -m autopass [-t<N>] ssh user@domain [-p port] <command>

-p<passwd>, specify the password.

-t<N>, specify a timeout in seconds. SIGKILL will be issued to child process after timeout. No timeout by default.

Password will be issued only once, so if the password is not correct, the child process will wait for a long time. This is your chance to place a timeout. Other cases for using timeout might be facing the terrible network. You can always place a relatively large timeout value to keep you from waiting like forever.

Password can also be exported to AUTOPASS environment variable.

$ export AUTOPASS='passwd'
$ python -m autopass <passwd-needed-command>

Autopass is focused on 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 return by autopass, you can use echo $? in your shell script to check if the command execution is successful.

Project details


Release history Release notifications | RSS feed

This version

0.13

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autopass-0.13.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

autopass-0.13-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file autopass-0.13.tar.gz.

File metadata

  • Download URL: autopass-0.13.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.3

File hashes

Hashes for autopass-0.13.tar.gz
Algorithm Hash digest
SHA256 df60007a3e4ba44e924996ec6c82908e697fc4e163c3499937527edc792aef78
MD5 c32349d64012267214ef72deb67e97dd
BLAKE2b-256 740a2846ecaaeff460782a9180467f4cd10c049c4785f6e04899999c8b2be9a6

See more details on using hashes here.

File details

Details for the file autopass-0.13-py3-none-any.whl.

File metadata

  • Download URL: autopass-0.13-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.3

File hashes

Hashes for autopass-0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 b2569a1e9df3e5519a5acb7c0e2db31262efbf0918884a92a7e372b4dabcddd3
MD5 b6561d48b406e666737e44e3b51e3f96
BLAKE2b-256 78e4e3174cc5826c35e09715a2e0f37444792e25f0629ed163988031d4fe065a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page