ropensci / ssh

Native SSH client in R based on libssh
https://docs.ropensci.org/ssh
Other
127 stars 21 forks source link

use all ~/.ssh/config parameters #35

Open klucar opened 4 years ago

klucar commented 4 years ago

I can't seem to get anything working with my .ssh/config file. The instructions say that it will use a key from .ssh/confg but it doesn't seem to use host aliases, or user names from the file.

Here's a pretty typical .ssh/config entry for me.

Host host_alias1 host_alias2
    HostName 1.2.3.4
    User myuser
    IdentityFile ~/.ssh/myuser_key.pem

It would be nice to fully read the config and use everything so I could just do a

ssh_connect('host_alias1')

and things would just work.

jeroen commented 4 years ago

Can you post your libssh_version() and output for ssh_connect('host_alias1', verbose = TRUE). Also which OS do you have?

teramonagi commented 4 years ago

@jeroen (Maybe) i have the same error with @klucar. I use Mac OS (10.14.6).I can use these .ssh/config settings from the terminal.

I hope that this information will be useful for u to solve this problem

> ssh_connect("stg-server", verbose = TRUE)
ssh_connect: libssh 0.8.6 (c) 2003-2018 Aris Adamantiadis, Andreas Schneider and libssh contributors. Distributed under the LGPL, please refer to COPYING file for information about your rights, using threading threads_pthread
ssh_connect_host_nonblocking: Failed to resolve hostname stg-server (nodename nor servname provided, or not known)
ssh_socket_connect: Nonblocking connection socket: -1
Error: libssh failure at 'connect': Failed to resolve hostname stg-access01 (nodename nor servname provided, or not known)
mpettis commented 4 years ago

I also have this issue, and my libssh version is also 0.8.6. That is, I cannot use a Host defined in my config file. The config file is a file within the path specified by ssh_home(). I'm on a windows box, and here is that call:

suppressPackageStartupMessages(library(ssh))
#> Warning: package 'ssh' was built under R version 3.6.2
libssh_version()
#> [1] "0.8.6"
ssh_home()
#> [1] "C:\\Users\\IRINZN\\.ssh"

## 'ds' is a name defined in my 'config' file in my ssh_home() directory.  Normal ssh functions work fine.
session <- ssh_connect("ds")
#> Error: libssh failure at 'connect': Failed to resolve hostname ds (No such host is known. )

sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United States.1252  
#>  ctype    English_United States.1252  
#>  tz       America/Chicago             
#>  date     2020-06-04                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version date       lib source        
#>  askpass       1.1     2019-01-13 [1] CRAN (R 3.6.1)
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.1)
#>  cli           2.0.2   2020-02-28 [1] CRAN (R 3.6.3)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.1)
#>  credentials   1.1     2019-03-12 [1] CRAN (R 3.6.2)
#>  digest        0.6.25  2020-02-23 [1] CRAN (R 3.6.3)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 3.6.1)
#>  fansi         0.4.1   2020-01-08 [1] CRAN (R 3.6.3)
#>  glue          1.4.1   2020-05-13 [1] CRAN (R 3.6.3)
#>  highr         0.8     2019-03-20 [1] CRAN (R 3.6.1)
#>  htmltools     0.4.0   2019-10-04 [1] CRAN (R 3.6.1)
#>  knitr         1.28    2020-02-06 [1] CRAN (R 3.6.3)
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 3.6.1)
#>  openssl       1.4.1   2019-07-18 [1] CRAN (R 3.6.1)
#>  Rcpp          1.0.4.6 2020-04-09 [1] CRAN (R 3.6.3)
#>  rlang         0.4.6   2020-05-02 [1] CRAN (R 3.6.3)
#>  rmarkdown     2.1     2020-01-20 [1] CRAN (R 3.6.3)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.1)
#>  ssh         * 0.6     2019-04-09 [1] CRAN (R 3.6.2)
#>  stringi       1.4.6   2020-02-17 [1] CRAN (R 3.6.2)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 3.6.1)
#>  sys           3.3     2019-08-21 [1] CRAN (R 3.6.1)
#>  withr         2.2.0   2020-04-20 [1] CRAN (R 3.6.3)
#>  xfun          0.13    2020-04-13 [1] CRAN (R 3.6.3)
#>  yaml          2.2.1   2020-02-01 [1] CRAN (R 3.6.3)
#> 
#> [1] C:/Users/IRINZN/Documents/R/R-3.6.1/library

Created on 2020-06-04 by the reprex package (v0.3.0)