locked
Access "system" library on remote RRS feed

  • Question

  • Hi friends,

    I would like know if I could access "system" library on remote. In concrete, I need decrypt a file inside the service.

    This works in local:
    system("gpg --decrypt /var/....", intern = TRUE)
    but it is not worked in remote. 

    I think it is consecuence the isolated workplace. What is better pathway?.

    Thanks for your answers.

    Kind regards,  

    Monday, November 20, 2017 2:35 PM

Answers

  • What is the error? You should be able to access the system function, but the user that it runs under ("rserve2" on Linux, "Network Service" on Windows) likely does not have access to gpg.
    • Marked as answer by CorsarioVasco Tuesday, November 21, 2017 2:42 PM
    Monday, November 20, 2017 5:55 PM
  • This comment is not fully correct but I appreciate your contribution because it has enlightened me . In my research, I found that the keys are stored in /home/rserve2/.gnupg/ based on remote session and default these are stored in .gnupg/.

    Solution: change the environment variable according to homedir

    sudo export GNUPGHOME="/home/rserve2/.gnupg/"

    Thanks for your replies,
    • Marked as answer by CorsarioVasco Tuesday, November 21, 2017 2:42 PM
    Tuesday, November 21, 2017 2:42 PM

All replies

  • What is the error? You should be able to access the system function, but the user that it runs under ("rserve2" on Linux, "Network Service" on Windows) likely does not have access to gpg.
    • Marked as answer by CorsarioVasco Tuesday, November 21, 2017 2:42 PM
    Monday, November 20, 2017 5:55 PM
  • Test with session:

        REMOTE> result <- system("gpg --yes --batch -r [e-mail] --passphrase=
        [youPassphrase] --armor --utf8-strings --decrypt youFile", intern = TRUE)
    
        REMOTE> result
        character(0)
        attr(,"status")
        [1] 2
    
        REMOTE> exit
        >Logout from remote R session complete
    

    Test without session:

        result <- system("gpg --yes --batch -r [e-mail] --passphrase= youPassphrase] --armor --utf8-strings --decrypt youFile", intern = 
        TRUE)
    
        gpg: encrypted with 2048-bit RSA key, ID XXXXXXX, created 2017-11-20 "name<e-mail>"
    
        >result
        [1] "Esta es la frase\r"
        [2] "que he encriptado\r"
    

    I need that it work based on remote session because this way works on service.

    Monday, November 20, 2017 9:06 PM
  • This comment is not fully correct but I appreciate your contribution because it has enlightened me . In my research, I found that the keys are stored in /home/rserve2/.gnupg/ based on remote session and default these are stored in .gnupg/.

    Solution: change the environment variable according to homedir

    sudo export GNUPGHOME="/home/rserve2/.gnupg/"

    Thanks for your replies,
    • Marked as answer by CorsarioVasco Tuesday, November 21, 2017 2:42 PM
    Tuesday, November 21, 2017 2:42 PM