2
votes

So, I created a small Shiny app and I hosted it on a server, let say server A. This app will try to connect to another server, let say server B by ssh. To do this connection, I used the run.remote from package ssh.utils of CRAN.

When I try to run my Shiny app from RStudio (with the "Run App" button) directly on server A, a small window is popping up asking for the password to gain access server B.

However, when I use shiny-server on server A and run the app, I see NO pop up window asking for the password. Yet on the shiny-server log I found the following message:

Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

Meaning that my app has tried three times to have access that I am not aware of.

My question is, what should I do with shiny-server so it will also pop out the window to ask password just like when I use Rstudio? Another is, I do not want to use the ssh private/public key.

The following is my simple code who lives in server A:

library(shiny)
library(shinyFiles)
library(ssh.utils)


ui <- fluidPage(
  navbarPage(title = "Main window",
             tabPanel(title = "Test SSH",
                      textInput(inputId="username", label = h3("Username:")),

                      actionButton("submit", "Submit")
             )
  )
)


server <- function(input, output, session) {

  observeEvent(input$submit, {
    ## submit function here ##

    res <- run.remote("randomScript",remote = paste0(input$username,"@server-b.de"))               
  })
}


shinyApp(ui = ui, server = server)

Thanks beforehand.

1

1 Answers

0
votes

I do not think you can pass a password to run.remote, the help text states (with regards to the remote argument):

Remote machine specification for ssh, in format such as user@server that does not require interactive password entry. For local execution, pass an empty string "" (default).

So the solution would be a passwordless ssh login.

I think the pop up box you get when using Rstudio is the dialogue box your OS/Desktop uses to ask for an SSH password.