Package 'askpass'

Title: Password Entry Utilities for R, Git, and SSH
Description: Cross-platform utilities for prompting the user for credentials or a passphrase, for example to authenticate with a server or read a protected key. Includes native programs for MacOS and Windows, hence no 'tcltk' is required. Password entry can be invoked in two different ways: directly from R via the askpass() function, or indirectly as password-entry back-end for 'ssh-agent' or 'git-credential' via the SSH_ASKPASS and GIT_ASKPASS environment variables. Thereby the user can be prompted for credentials or a passphrase if needed when R calls out to git or ssh.
Authors: Jeroen Ooms [aut, cre]
Maintainer: Jeroen Ooms <[email protected]>
License: MIT + file LICENSE
Version: 1.2.1
Built: 2024-10-03 19:14:44 UTC
Source: https://github.com/r-lib/askpass

Help Index


Password Prompt Utility

Description

Prompt the user for a password to authenticate or read a protected key. By default, this function automatically uses the most appropriate method based on the user platform and front-end. Users or IDEs can override this and set a custom password entry function via the askpass option.

Usage

askpass(prompt = "Please enter your password: ")

Arguments

prompt

the string printed when prompting the user for input.

Details

By default askpass() returns NULL in non-interactive sessions. (These include knitr runs and testthat tests.) If you want to force a password prompt in non-interactive sessions, set the rlib_interactive option to TRUE:

options(rlib_interactive = TRUE)

Examples

# Prompt user for passwd
pw <- askpass("Please enter your password")

ASKPASS CMD TOOL

Description

This returns the path to the native askpass executable which can be used by git-credential or ssh-agent. Most users don't have worry about this.

Usage

ssh_askpass()

Details

On Windows and MacOS the package automatically sets the SSH_ASKPASS and GIT_ASKPASS variables on load (if not already set). If these are set you should be able to run e.g. sys::exec_wait("ssh-add") and you should be prompted for a passphrase if your key is protected.