Way to securely give a password to R application from the terminal?

前端 未结 5 709
闹比i
闹比i 2020-11-29 04:24

Does R have a function that allows a user to provide a password securely, such as Python\'s getpass module?

(see http://docs.python.org/library/getpass.

5条回答
  •  迷失自我
    2020-11-29 05:05

    My package keyringr solves this problem by retrieving passwords from the underlying operating system keyring (DPAPI on Windows, Keychain on OSX and the Gnome Keyring on Linux).

    The vignette gives a detailed explanation on how to use the package, but if you were using OSX and have the password saved in Keychain, you could use the following command to return the password to R (where mydb_myuser is the Keychain item name):

    install.packages("keyringr")
    library("keyringr")
    mypwd <- decrypt_kc_pw("mydb_myuser")
    print(mypwd)
    

提交回复
热议问题