I work with an SQL database connecting to it in RStudio, and I am trying to find a way to hide my password from other colleagues for common reasons. I cam across this solution using .rs.askForPassword
. However, the created element still shows up in environment in the values area showcasing the password entered on the screen. Is there a way to create it as a hidden object? Or, perhaps, an alternative solution for handling DB passwords altogether?
Asked
Active
Viewed 155 times
0

user000
- 123
- 7
-
2perhaps `keyring` is an option? https://support.rstudio.com/hc/en-us/articles/360000969634-Using-Keyring-in-the-RStudio-IDE – Wimpel Nov 10 '21 at 08:44
-
See also the `{keychain}` package. – Mossa Nov 10 '21 at 08:49
-
@Wimpel it suits me perfectly and is a quick fix, thanks! – user000 Nov 10 '21 at 08:56
2 Answers
2
Thanks to a suggestion by @Wimpel I used Keyring to fix my problem. A little more detailed look into it can be seen here. In short, I used the command rstudioapi::askForSecret
directly in SQL server connection setup, so I don't have to create an object containing my password dbConnect(odbc::odbc(), password = **rstudioapi::askForSecret("password")**)

user000
- 123
- 7
0
Since you work with sql, have you tried to just simply hash it with SHA1 encryption ?
SHA1(string)
You can also tick an option to hide the values in phpmyadmin thus showcasing it with ***
-
But I still need to see other elements' values. Anyways, ```rstudioapi::askForSecret``` solved the problem. – user000 Nov 10 '21 at 09:01