Skip to main content

Entering password automatically for sudo, ssh and scp

Project description

Autopass

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! 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 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 exported to AUTOPASS environment variable.

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

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... ^____^

Project details


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.14.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autopass-0.14-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autopass-0.14.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for autopass-0.14.tar.gz
Algorithm Hash digest
SHA256 a259d0cccaab1e9a168c2fcc41e718718429d8379deb07326bb9f131ca3ba603
MD5 e4a8501fef99f2bb7c902fa4b00753cb
BLAKE2b-256 b61c869a45f189b570ff2e5ad715ad3781b88c6955ca75dbf6bb8fe3e8bdf7dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autopass-0.14-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for autopass-0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 b446668edc064d7bfe6769d6199cbfc73ad4f5216feb9ef45a7a63c247a99740
MD5 d7df5393dc4e4e23a6eb9efd9feb9730
BLAKE2b-256 7e66ef28096622e2fb680d38e10889f759d67cb6131bbf4851796a8e1ee6647c

See more details on using hashes here.

Supported by

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