ropensci / ssh Goto Github PK
View Code? Open in Web Editor NEWNative SSH client in R based on libssh
Home Page: https://docs.ropensci.org/ssh
License: Other
Native SSH client in R based on libssh
Home Page: https://docs.ropensci.org/ssh
License: Other
I can create a connected session, however, when trying to upload or download files, I get the errors below. It works on some SFTPs, however, a few other ones always get stuck at the upload/download after creating a successful session. Same error on Windows and Linux.
Upload error
"Error: SCP failure: Failed executing command: scp -t -r '/folder/'"
Download error
Error: SCP failure: Failed executing command: scp -f -r '/folder/*'
Thank you!
Error with verbose = 4:
ssh_scp_init: Initializing scp session write recursive on location '/SB/'
channel_open: Creating a channel 43 with 64000 window and 32768 max packet
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
packet_send2: packet: wrote [len=44,padding=19,comp=24,payload=24]
channel_open: Sent a SSH_MSG_CHANNEL_OPEN type session for channel 43
ssh_socket_pollcallback: Poll callback on socket 31 (POLLOUT ), out buffer 0
ssh_socket_pollcallback: sending control flow event
ssh_packet_socket_controlflow_callback: sending channel_write_wontblock callback
ssh_socket_pollcallback: Poll callback on socket 31 (POLLIN ), out buffer 0
ssh_packet_socket_callback: packet: read type 91 [len=28,padding=10,comp=17,payload=17]
ssh_packet_process: Dispatching handler for packet type 91
ssh_packet_channel_open_conf: Received SSH2_MSG_CHANNEL_OPEN_CONFIRMATION
ssh_packet_channel_open_conf: Received a CHANNEL_OPEN_CONFIRMATION for channel 43:0
ssh_packet_channel_open_conf: Remote window : 33554432, maxpacket : 35840
ssh_scp_init: Executing command: scp -t -r '/SB/'
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
packet_send2: packet: wrote [len=44,padding=9,comp=34,payload=34]
channel_request: Sent a SSH_MSG_CHANNEL_REQUEST exec
ssh_socket_pollcallback: Poll callback on socket 31 (POLLOUT ), out buffer 0
ssh_socket_pollcallback: sending control flow event
ssh_packet_socket_controlflow_callback: sending channel_write_wontblock callback
ssh_socket_pollcallback: Poll callback on socket 31 (POLLIN ), out buffer 0
ssh_packet_socket_callback: packet: read type 100 [len=12,padding=6,comp=5,payload=5]
ssh_packet_process: Dispatching handler for packet type 100
ssh_packet_channel_failure: Received SSH_CHANNEL_FAILURE on channel (43:0)
channel_request: Channel request exec failed
ssh_scp_init: Failed executing command: scp -t -r '/SB/'
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
packet_send2: packet: wrote [len=12,padding=6,comp=5,payload=5]
ssh_channel_send_eof: Sent a EOF on client channel (43:0)
ssh_channel_read_timeout: Read (128) buffered : 0 bytes. Window: 64000
ssh_socket_pollcallback: Poll callback on socket 31 (POLLOUT ), out buffer 0
ssh_socket_pollcallback: sending control flow event
ssh_packet_socket_controlflow_callback: sending channel_write_wontblock callback
ssh_socket_pollcallback: Poll callback on socket 31 (POLLIN ), out buffer 0
ssh_packet_socket_callback: packet: read type 98 [len=44,padding=18,comp=25,payload=25]
ssh_packet_process: Dispatching handler for packet type 98
channel_rcv_request: received exit-status 0
ssh_packet_socket_callback: Processing 48 bytes left in socket buffer
ssh_packet_socket_callback: packet: read type 97 [len=12,padding=6,comp=5,payload=5]
ssh_packet_process: Dispatching handler for packet type 97
channel_rcv_close: Received close on channel (43:0)
channel_rcv_close: Remote host not polite enough to send an eof before close
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
packet_send2: packet: wrote [len=12,padding=6,comp=5,payload=5]
ssh_channel_close: Sent a close on client channel (43:0)
Error: SCP failure: Failed executing command: scp -t -r '/SB/'
I am behind a (corporate) authenticating proxy and have been able to establish an ssh
connection using the ProxyCommand
option (via connect.c
program [and environmemt variables HTTP_PROXY_USER and HTTP_PROXY_PASSWORD])
Here is an anonymized session (local/remote usr and machine/ip):
pc_usr@pc_machine MINGW64 ~
$ ssh -p 2230 -l remote_usr remote.server.org
[email protected]'s password:
Last login: Tue Aug 20 08:07:49 2019 from 111.111.111.111
I was hoping to be able to use ropensci/ssh
R package in the same way but I saw from @hrbrmstr's changes mentioned in #16 that support for ssh config file is not implemented.
So I gave it a try by installing @hrbrmstr's fork and trying to connect:
> ssh::ssh_connect("remote.server.org", user = "remote_user", port = 2230, config = "~/.ssh/config", verbose = 4)
ssh_config_parse_file: Reading configuration data from C:/Users/pc_usr/.ssh/config
ssh_connect: libssh 0.8.3 (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_socket_connect: Nonblocking connection socket: 1252
ssh_connect: Socket connecting, now waiting for the callbacks to work
ssh_connect: Actual timeout : 10000
ssh_connect: Timeout connecting to remote.server.org
ssh_connect: current state : 9
packet_send2: packet: wrote [len=28,padding=7,comp=20,payload=20]
Error: libssh failure at 'connect': Timeout connecting to remote.server.org
...and I failed miserably 😢
Here is the ProxyCommand line in my ~/.ssh/config
(proxy's IP and user's ID changed):
ProxyCommand /c/Users/pc_usr/dev/connect.exe -H 111.22.333.444:9512 %h %p
In fact the error is the same as the one I had before configuring the ProxyCommand
option, so maybe the parsing/execution of the relevant command is not working....
Any helps to find a solution to this setup or any other one is highly appreciated!
Thank you in advance for considering my request!!!!!!!!!!!
I am on MS Windows 10 PC using GitBash and ssh as follows:
$ ssh -V
OpenSSH_7.6p1, OpenSSL 1.0.2n 7 Dec 2017
$ bash --version
GNU bash, version 4.4.12(2)-release (x86_64-pc-msys)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
It appears ssh doesn't support ipv6 address scheme. Referring to issue raised on [https://stackoverflow.com/questions/53138493/ssh-ipv6-address-in-r-ssh-package]. Can I hope for added support of ipv6 in near future from developers?
I noticed that this neither modifies known_hosts or checks it (and warns if not in the list). Is this something that should be enabled perhaps? Is that possible with libssh?
Each time I open a session I see the same message "New server fingerprint"
`
connected: user@server:22 server: c7:08:f6:9b:44:fb:ed:7f:66:aa:61:a6:d5:2b:ef:5c:71:4c:97:54 ` Then the server key keeps adding to ~/.ssh/known_hosts and the message keeps popping up and the key keeps addingssh::ssh_connect(hostname)
New server fingerprint: c7:08:f6:9b:44:fb:ed:7f:66:aa:61:a6:d5:2b:ef:5c:71:4c:97:54
Please check it
P.S. I've checked the source code and found the line 146 in src/session.c:
if(!ssh_is_server_known(ssh)){ Rprintf("New server fingerprint: %s\n", ssh_get_hexa(hash, hlen)); ssh_write_knownhost(ssh); }
At the same time, libssh API stays that ssh_is_server_known is deprecated http://api.libssh.org/master/group__libssh__session.html#ga6f37e3d7bb6b938b44d6a34a76fdfa0b
ssh::scp_download
just warns if upload fails rather than errors - can this be turned into an error (even if it's an option that one has to set)?
Strangely when I use scp_upload
progress will go from 0% to 4%, then wraparound to -4% and continue incrementing (so only values -4% to 4% are displayed).
The file I am transferring is 574236321 bytes. This is a little over 1/4 of the max value of an int. Thus when multiplying by 100 we easily get an overflow.
Lines 184 to 196 in 8967d3e
Fix is simple: use a long for total
. I can attempt a PR if you wish.
Not sure if bug or i'm doing something wrong, switching to another user using sudo fails?
ssh_exec_wait(session, c('echo "mypassword!" | sudo -S su - user2'))
then when running the whoami
still returns user1.
Any input welcome, thanks.
Hi.
I'm interested in setting up a tunnel to localhost.run.
Running their command line examples work great, and as advertised.
R-stuff ssh -R 80:localhost:1313 [email protected]
===============================================================================
[...]
** your connection id is 26493725-4c74-4375-94c1-293a63b33a18, please mention it if you send me a message about an issue. **
f27f2133f61afa.localhost.run tunneled with tls termination, https://f27f2133f61afa.localhost.run
and I can see whatever I'm serving on that localhost port at the url provided.
I'm trying to set up this infrastructure using this package, but am not managing properly.
problems:
I dont think the tunnel is set up correctly by my settings. The unique url is not outputted by the call I'm doing, which is why I'm not convinced I've done as the service requires. But it is also not erroring, so I'm not sure.
I need to capture the unique url to use as an oAuth redirect.
proc <- callr::r_bg(function(){
session <- ssh::ssh_connect("[email protected]")
ssh::ssh_tunnel(session, 8080, "localhost.run:80")
})
> proc$read_all_output()
[1] "\n** your connection id is e1e78880-c784-44be-9cee-90eab314a46b, please mention it if you send me a message about an issue. **\n\n\n"
Any tip is appreciated, I'm pretty new to this. I'm using the call suggested by #13
I want to know how much free memory on each node simultaneously. The code I run as following:
get.remote.free.mem <- function(ssh.session) {
out <- ssh_exec_internal(ssh.session, command = c('cat /proc/meminfo'));
mem = floor(as.numeric(stringr::str_extract(sys::as_text(out$stdout)[3], '\\d+'))/1024/1024);
return(mem)
}
# SSH.SESSION is a list, every item of which is a ssh session
free.mem.list = parallel::mclapply(SSH.SESSION, get.remote.free.mem, mc.cores = length(SSH.SESSION))
I found that for this code mclapply can run normally only once. After I get the the free memory, re-running the last state (parallel::mclapply) will raise "Error: libssh failure at 'ssh_channel_open_session': Socket error: disconnected".
I am trying to use scp_download()
to download files matching a pattern from a remote server, but somehow it does not interpret wildcrads in the target
argument and claims that the file does not exists. I verified that the file exists and that scp_download() works.
I am using Rstudio Version 1.4.1717 on Windows 10 and connect to a remote server running arch linux.
$ scp [email protected]:/home/licor/data/summaries/2021-* .
Output:
2021-07-23_smart3-00545_EP-Summary.txt 100% 31KB 257.0KB/s 00:00
2021-07-24_smart3-00545_EP-Summary.txt 100% 67KB 368.1KB/s 00:00
2021-07-25_smart3-00545_EP-Summary.txt 100% 67KB 430.0KB/s 00:00
scp_download(session,"/home/licor/data/summaries/",to = temp_path_name)
Output:
0 C:\Users\Sebastian\Documents\normalising-data-parser\R\scp_1636031448/summaries
31388 C:\Users\Sebastian\Documents\normalising-data-parser\R\scp_1636031448/summaries/2021-07-23_smart3-00545_EP-Summary.txt
69099 C:\Users\Sebastian\Documents\normalising-data-parser\R\scp_1636031448/summaries/2021-07-24_smart3-00545_EP-Summary.txt
69106 C:\Users\Sebastian\Documents\normalising-data-parser\R\scp_1636031448/summaries/2021-07-25_smart3-00545_EP-Summary.txt
68978 C:\Users\Sebastian\Documents\normalising-data-parser\R\scp_1636031448/summaries/2021-07-26_smart3-00545_EP-Summary.txt
68975 C:\Users\Sebastian\Documents\normalising-data-parser\R\scp_1636031448/summaries/2021-07-27_smart3-00545_EP-Summary.txt
Command in R:
scp_download(session,"/home/licor/data/summaries/2021-07-23_smart3-00545_EP-Summary.txt",to = temp_path_name)
Output:
31388 C:\Users\Sebastian\Documents\normalising-data-parser\R\scp_1636031448/2021-07-23_smart3-00545_EP-Summary.txt
scp_download(session,"/home/licor/data/summaries/2021-*",to = temp_path_name)
Output:
Warning: SSH warning: scp: /home/licor/data/summaries/2021-*: No such file or directory
I've been using this package to download files from a linux cluster at work for quite some time and it has worked great.
But now I've run into a problem I can't figure out. I get the following error when I try to download:
Error in sprintf("%10d %s\n", length(data), target) :
invalid format '%10d'; use format %f, %e, %g or %a for numeric objects
Error during wrapup: long vectors not supported yet: ../../../../R-3.5.2/src/include/Rinlinedfuns.h:519
I've successfully downloaded all the files using scp from a terminal now. It is app 45 GB in total with the biggest being 6.5 GB and roughly 100M lines. But I guess this shouldn't really matter, or?
I've tried with the CRAN version as well as the github version, but same error.
Any ideas?
─ Session info ──────────────────────────────────────
setting value
version R version 3.5.2 (2018-12-20)
os macOS Mojave 10.14.3
system x86_64, darwin15.6.0
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz Europe/Copenhagen
date 2019-02-14
─ Packages ────────────────────────────────────────
package * version date lib source
assertthat 0.2.0 2017-04-11 [1] CRAN (R 3.5.0)
backports 1.1.3 2018-12-14 [1] CRAN (R 3.5.0)
bindr 0.1.1 2018-03-13 [1] CRAN (R 3.5.0)
bindrcpp 0.2.2 2018-03-29 [1] CRAN (R 3.5.0)
broom 0.5.1 2018-12-05 [1] CRAN (R 3.5.1)
callr 3.1.1 2018-12-21 [1] CRAN (R 3.5.0)
cellranger 1.1.0 2016-07-27 [1] CRAN (R 3.5.0)
cli 1.0.1 2018-09-25 [1] CRAN (R 3.5.0)
colorspace 1.4-0 2018-11-28 [1] R-Forge (R 3.5.1)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.0)
curl 3.3 2019-01-10 [1] CRAN (R 3.5.2)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.0)
devtools 2.0.1 2018-10-26 [1] CRAN (R 3.5.1)
digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.1)
dplyr * 0.7.8 2018-11-10 [1] CRAN (R 3.5.0)
forcats * 0.3.0 2018-02-19 [1] CRAN (R 3.5.0)
fs * 1.2.6 2018-08-23 [1] CRAN (R 3.5.0)
generics 0.0.2 2018-11-29 [1] CRAN (R 3.5.0)
ggplot2 * 3.1.0 2018-10-25 [1] CRAN (R 3.5.1)
glue * 1.3.0 2018-07-17 [1] CRAN (R 3.5.1)
gtable 0.2.0 2016-02-26 [1] CRAN (R 3.5.0)
haven 2.0.0 2018-11-22 [1] CRAN (R 3.5.0)
hms 0.4.2.9001 2018-08-28 [1] Github (tidyverse/hms@979286f)
httr 1.4.0 2018-12-11 [1] CRAN (R 3.5.0)
jsonlite 1.6 2018-12-07 [1] CRAN (R 3.5.0)
lattice 0.20-38 2018-11-04 [1] CRAN (R 3.5.2)
lazyeval 0.2.1 2017-10-29 [1] CRAN (R 3.5.0)
lubridate 1.7.4 2018-04-11 [1] CRAN (R 3.5.0)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.0)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.0)
modelr 0.1.3 2019-02-05 [1] CRAN (R 3.5.2)
munsell 0.5.0 2018-06-12 [1] CRAN (R 3.5.0)
nlme 3.1-137 2018-04-07 [1] CRAN (R 3.5.2)
packrat 0.5.0 2018-11-14 [1] CRAN (R 3.5.0)
pathfinder * 0.0.0.9000 2018-12-20 [1] gitlab (ldalby/pathfinder@abe90c9)
pillar 1.3.1 2018-12-15 [1] CRAN (R 3.5.0)
pkgbuild 1.0.2 2018-10-16 [1] CRAN (R 3.5.1)
pkgconfig 2.0.2 2018-08-16 [1] CRAN (R 3.5.0)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.0)
plyr 1.8.4 2016-06-08 [1] CRAN (R 3.5.0)
prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.0)
processx 3.2.1 2018-12-05 [1] CRAN (R 3.5.1)
ps 1.3.0 2018-12-21 [1] CRAN (R 3.5.0)
purrr * 0.3.0 2019-01-27 [1] CRAN (R 3.5.2)
R6 2.3.0 2018-10-04 [1] CRAN (R 3.5.0)
Rcpp 1.0.0 2018-11-07 [1] CRAN (R 3.5.1)
readr * 1.3.1 2018-12-21 [1] CRAN (R 3.5.0)
readxl 1.2.0 2018-12-19 [1] CRAN (R 3.5.0)
remotes 2.0.2 2018-10-30 [1] CRAN (R 3.5.1)
rlang 0.3.1 2019-01-08 [1] CRAN (R 3.5.2)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.0)
rstudioapi 0.9.0 2019-01-09 [1] CRAN (R 3.5.2)
rvest 0.3.2 2016-06-17 [1] CRAN (R 3.5.0)
scales 1.0.0 2018-08-09 [1] CRAN (R 3.5.0)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.0)
ssh * 0.3 2019-02-14 [1] Github (d5053a0)
stringi 1.3.1 2019-02-13 [1] CRAN (R 3.5.2)
stringr * 1.4.0 2019-02-10 [1] CRAN (R 3.5.2)
testthat 2.0.1 2018-10-13 [1] CRAN (R 3.5.0)
tibble * 2.0.1 2019-01-12 [1] CRAN (R 3.5.2)
tidyr * 0.8.2 2018-10-28 [1] CRAN (R 3.5.1)
tidyselect 0.2.5 2018-10-11 [1] CRAN (R 3.5.1)
tidyverse * 1.2.1 2017-11-14 [1] CRAN (R 3.5.0)
usethis 1.4.0 2018-08-14 [1] CRAN (R 3.5.0)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.0)
xml2 1.2.0 2018-01-24 [1] CRAN (R 3.5.0)
[1] /Library/Frameworks/R.framework/Versions/3.5/Resources/library
hi
I can start connection with another Windows host and execute there the commands with ssh_exec_internal as usual
but scp_upload does not seem to be working:
> ssh::scp_upload(.Object@session, "D:/temp/Args.txt", "c:\\Users\\User")
Error: SCP failure: SCP: Warning: status code 1 received: scp: 'c:/Users/User': No such file or directory
Looks like it transforms the paths from Windows style to Unix style, but it does not work
To be sure that the connection is working I tried
> ssh::scp_upload(.Object@session, "D:/temp/Args.txt", "1")
[100%] D:\temp\shu\prn824\model_pk\jobArgsCombined.txt
[1] "1"
in such case file args.txt is copied on the host, but has a strange name '1' (with ticks), same for other names I tried.
Are there any workarounds I missed?
Looking at ssh_exec_wait and trying to interpret the stdout stream of the remote process I found that ssh_exec_wait only checks for TRUE, empty string (leading to stdout), a string as filename (creating a connection object) or a connection object. Therefore, a callback function as listed in possible values for the std_out and std_err parameters in the doc is not considered:
session <- ssh::ssh_connect("dev.opencpu.org")
ssh::ssh_exec_wait(session, command = c('ls'), std_out = function(x) {print(as_text(x))})
ssh::ssh_disconnect(session)
Hello,
Thank you for this very usefull package!
I'm trying to install it on a rocker/shiny:3.4.4 container but get this message. "package ‘ssh’ is not available (for R version 3.4.4)"
Does anyone already manage to install it onto rocker image?
Thank you.
See https://travis-ci.org/ropensci/ssh/jobs/494476315
gcc -std=gnu99 -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I/home/travis/R-bin/include -fpic -g -O2 -c session.c -o session.o
session.c: In function ‘auth_any’:
session.c:98:5: warning: implicit declaration of function ‘ssh_userauth_publickey’ [-Wimplicit-function-declaration]
session.c:100:5: warning: implicit declaration of function ‘ssh_userauth_publickey_auto’ [-Wimplicit-function-declaration]
session.c: In function ‘C_start_session’:
session.c:115:5: warning: implicit declaration of function ‘ssh_pki_import_privkey_file’ [-Wimplicit-function-declaration]
session.c:144:3: warning: implicit declaration of function ‘ssh_get_publickey’ [-Wimplicit-function-declaration]
session.c:145:3: warning: implicit declaration of function ‘ssh_get_publickey_hash’ [-Wimplicit-function-declaration]
session.c:145:42: error: ‘SSH_PUBLICKEY_HASH_SHA1’ undeclared (first use in this function)
session.c:145:42: note: each undeclared identifier is reported only once for each function it appears in
session.c: In function ‘C_ssh_info’:
session.c:191:3: warning: implicit declaration of function ‘ssh_options_get_port’ [-Wimplicit-function-declaration]
session.c:192:3: warning: implicit declaration of function ‘ssh_options_get’ [-Wimplicit-function-declaration]
session.c:201:42: error: ‘SSH_PUBLICKEY_HASH_SHA1’ undeclared (first use in this function)
Hi,
Thank you for the nice package! It is very useful.
I have problems downloading large files using scp_download.
I need to download files that are on the order of 5-10 GB. The transfer starts and the R-programs seems to work intensively but I think that freezes. The file on the disk gets all the time to a maximum of 860,972 KB.
The server hosting the files is running centos and I tried to transfer the file using a windows 11 laptop and using a windows server 2012 R2. After the file reaches the 860,972 KB size you can see on the task manager that the network transfer is stopped.
I have no problems transferring the files using the WinSCP application.
The code that I am using is simple:
I ssh to the server using:
session <- ssh_connect("zzzz@sssssss")
Then I start the transfer using:
scp_download(session, file_path, to = localDir, verbose = TRUE)
I also tried with verbose=FALSE
.
R Windows 3.5.3 (64Bit) ssh_connect 0.5 fails automated -- password passed via askpass earlier in program and works with Rcurl ftpUpload -- fails in ssh. Works interactively if passwd not provided in connect string.
Works in 0.4 version. Issue found with new user install with the 0.5 version.
Code snippet with sever name masked:
library('askpass')
userid=askpass('Enter userid for #####:')
passw=askpass('Enter password for #####:')
session <- ssh_connect(paste(userid,"@#####.company.com",sep=''),passwd=passw)
print(session)
out <- ssh_exec_wait(session, command = cmd)
print(out)
ssh_disconnect(session)
Hi. Still very very green in ssh. I'm getting the following error, what impact does it have on what I intend to do (connecting to AWS) and how do I mitigate for that?
ssh_known_hosts_read_entries: Failed to open the known_hosts file '/etc/ssh/ssh_known_hosts': No such file or directory
Strange that the two functions have different verbose outputs.
In fact stream_to_r
actually has a print statement commented out:
Line 54 in deee5ba
Hi @jeroen,
I noticed that list_all is tossing an error when existing directories are provided.
It looks like the if
statement in list_all
in scp.R:73 is the culprit:
if(!file.exists(path))
based on the code that follows, it should be:
if(!file.exists(path) & !dir.exists(path))
Not really major enough for a pull request so I just posted here.
Thanks for your work on this package!
@jennybc asks if we can make key management easier. We can easily let the use generate a keypair, though I am not sure if we should write to ~/.ssh/id_rsa
or use a custom location.
It would also be nice to support something like ssh-copy-id
to let users store the pubkey that was used to authenticate the current session into ~/.ssh/authorized_keys
on the server. Does libssh support something like this @cryptomilk?
I am having trouble getting an SSH tunnel to work for the purpose of connecting to a MongoDB database. I think this is an issues in ssh. Here is what I'm doing, though I can't provide access to the database:
In session 1:
> session <- ssh::ssh_connect("USER@SERVER")
> session
<ssh session>
connected: [email protected]:22
server: 3b:cd:9c:b4:81:27:dc:82:14:f6:ba:f2:b9:86:14:fc:d5:fd:c7:fb
> ssh::ssh_exec_wait(session, "ls")
list
mini-files.js
source-vars.sh
source-vars.sh.backup
test
test.sh
[1] 0
> ssh::ssh_tunnel(session, port = 27017, target = "SERVER:27018")
- Waiting for connection on port 27017.
OK, that's working, so in session 2:
> pm <- mongolite::mongo(collection = "COLLECTION", db = "DATABASE", url = "mongodb://localhost:27017")
Error: No suitable servers found (`serverSelectionTryOnce` set): [socket timeout calling ismaster on 'localhost:27017']
Then back in session 1, I see:
> ssh::ssh_tunnel(session, port = 27017, target = "SERVER:27018")
- Waiting for connection on port 27017... client connected!
And after a bit...
\ Tunneled -1 bytes...tunnel closed!
Though when I did this again I got
Error: libssh failure at 'channel_open_forward': Socket error: Success
I'm authenticating via ssh keys and I note that the Mongo connection works fine when I just run ssh -L 27017:localhost:27018 USER@SERVER
in a terminal.
$ apt-cache show libssh-dev
Package: libssh-dev
Source: libssh
Version: 0.7.3-2
Installed-Size: 987
Maintainer: Laurent Bigonville <[email protected]>
Architecture: amd64
Replaces: libssh-2-dev
Depends: libssh-4 (= 0.7.3-2), libssl1.0-dev, zlib1g-dev
Suggests: libssh-doc
Conflicts: libssh-2-dev, libssh-gcrypt-dev
Description: tiny C SSH library. Development files (OpenSSL flavor)
Description-md5: d362c341109d91d7f2254bfdde582874
Homepage: https://www.libssh.org/
Tag: devel::lang:c, devel::library, implemented-in::c, protocol::ssh,
role::devel-lib, security::authentication
Section: libdevel
Priority: optional
Filename: pool/main/libs/libssh/libssh-dev_0.7.3-2_amd64.deb
Size: 210922
MD5sum: 82399f3e9ef465b944d49b0ab67a9e95
SHA256: bd92aef20fb8dbbfddbc8f3b29d2452f6e04bd02e65b534cedaf14e29fd387de
Session info:
> library(ssh)
> library(mongolite)
> devtools::session_info()
Session info ------------------------------------------------------------------
setting value
version R version 3.5.1 (2018-07-02)
system x86_64, linux-gnu
ui X11
language (EN)
collate en_US.UTF-8
tz Etc/UTC
date 2018-09-20
Packages ----------------------------------------------------------------------
package * version date source
base * 3.5.1 2018-08-29 local
compiler 3.5.1 2018-08-29 local
datasets * 3.5.1 2018-08-29 local
devtools 1.13.6 2018-06-27 CRAN (R 3.5.0)
digest 0.6.16 2018-08-22 cran (@0.6.16)
graphics * 3.5.1 2018-08-29 local
grDevices * 3.5.1 2018-08-29 local
jsonlite 1.5 2017-06-01 CRAN (R 3.5.1)
memoise 1.1.0 2018-06-18 Github (hadley/memoise@06d16ec)
methods * 3.5.1 2018-08-29 local
mongolite * 2.0 2018-08-09 CRAN (R 3.5.1)
ssh * 0.2 2018-06-04 CRAN (R 3.5.1)
stats * 3.5.1 2018-08-29 local
tools 3.5.1 2018-08-29 local
unixtools 0.1-1 2018-08-29 Github (s-u/unixtools@ba71937)
utils * 3.5.1 2018-08-29 local
withr 2.1.2 2018-03-15 CRAN (R 3.5.1)
OS is a Rocker Docker image (built on top of geopatial/latest), running inside Ubuntu 14.04
We wanted to use ssh
package in our organization but found libssh could have a high security risk. There are quite some news about vulnerability issues with libssh.
Is it possible to use some alternatives? Or what need to be done to reduce the security risk with libssh?
I am using the below Python code to get data from a remote Redshift database. I am using this function with the reticulate package in R. I want to convert the Python code to R so that I do not face the hassle of setting up an Anaconda environment in the cloud when I push my code (shiny app) to shipapps.io. I read about the SSH package and its capabilities but I could not successfully convert my code using it.
def get_redshift_data(query):
import pandas as pd
from sqlalchemy import create_engine
from sqlalchemy import Table, MetaData
import pymysql
import paramiko
from paramiko import SSHClient
from sshtunnel import SSHTunnelForwarder
from sqlalchemy.engine import url as u
mypkey = paramiko.RSAKey.from_private_key_file('nfw-linux-key.pem')
sql_username = 'my_sql_username'
sql_hostname = '[email protected]'
sql_password = 'my_sql_password'
sql_main_database = 'my_db'
sql_port = 5439
ssh_host = '127.0.0.1'
ssh_user = 'ubuntu'
ssh_port = 56714
sql_ip = '1.1.1.1.1'
with SSHTunnelForwarder(
(ssh_host, ssh_port),
ssh_username=ssh_user,
ssh_pkey=mypkey,
remote_bind_address=(sql_hostname, sql_port)) as tunnel:
conn_url = u.URL(drivername='postgresql+psycopg2', username=sql_username,
password=sql_password, host='127.0.0.1',
port=tunnel.local_bind_port, database=sql_main_database)
conn = create_engine(conn_url)
result = pd.read_sql(query, conn)
return result
Then I am sourcing the Python function above to get data from the database.
library(reticulate)
source_python("get_redshift_data.py")
df = get_redshift_data("select top 100 * from my_db.my_table")
But I want to avoid the Python part and use R only.
I've been unable to find a conda R ssh installation. If this isn't available, I think having one could be useful.
I tried to connect to an OpenSSH server from MacOS:
library(ssh)
session <- ssh_connect("[email protected]", keyfile = "id_rsa_iih", verbose = 1)
ssh_pki_import_privkey_base64: Trying to decode privkey passphrase=false
socket_callback_connected: Socket connection callback: 1 (0)
ssh_client_connection_callback: SSH server banner: SSH-2.0-srtSSHServer_11.00
ssh_analyze_banner: Analyzing banner: SSH-2.0-srtSSHServer_11.00
ssh_packet_disconnect_callback: Received SSH_MSG_DISCONNECT: 3:invalid DH value
Error: libssh failure at 'connect': Received SSH_MSG_DISCONNECT: 3:invalid DH value
When I tried from the console I got this error:
ssh -i id_rsa_iih [email protected]
Unable to negotiate with 123.456.789.111 port 22: no matching host key type found. Their offer: ssh-dss
This I could correct and get to the next issue via:
ssh -i id_rsa_iih -oHostKeyAlgorithms=+ssh-dss [email protected]
Unable to negotiate with 123.456.789.111 port 22: no matching cipher found. Their offer: 3des-ctr,aes256-cbc,twofish256-cbc,twofish-cbc,aes128-cbc,twofish128-cbc,blowfish-cbc,3des-cbc,cast128-cbc
Finally I could connect successfully via:
ssh -i id_rsa_iih -c aes256-cbc -oHostKeyAlgorithms=+ssh-dss [email protected]
But I would like to apply the same fix to the R code, although I'm not sure they are the same. As of now I would need to use a system()
call that I would like to migrate away from to use this library.
You may be interested in our approach here: https://github.com/snoweye/pbdRPC
It's still evolving, and there's certainly room for multiple approaches. But saw this and just wanted to give a heads up.
Excellent stuff here, very nice!
Does ssh tunnel support port forwarding? (e.g. such that one could run RStudio-server on a server that has no ports open that could allow a direct http connection, but by forwarding the port through the tunnel one could access the server RStudio over localhost?)
having scp
support looks particularly useful. Would bindings for rsync
/ librsync
also be in scope for this (or maybe as a separate package?)
There should be a way to setup an interactive shell. Maybe just keep sending commands to the same channel? I think we had this before with a very old version of the package.
For example: #18
session.c: In function 'C_start_session':
session.c:145:3: warning: 'ssh_get_publickey' is deprecated [-Wdeprecated-declarations]
assert_ssh(ssh_get_publickey(ssh, &key), "ssh_get_publickey", ssh);
^~~~~~~~~~
In file included from myssh.h:5:0,
from session.c:1:
/usr/include/libssh/libssh.h:489:31: note: declared here
SSH_DEPRECATED LIBSSH_API int ssh_get_publickey(ssh_session session, ssh_key *key);
^~~~~~~~~~~~~~~~~
session.c: In function 'C_ssh_info':
session.c:181:3: warning: 'ssh_get_publickey' is deprecated [-Wdeprecated-declarations]
assert_ssh(ssh_get_publickey(ssh, &key), "ssh_get_publickey", ssh);
^~~~~~~~~~
In file included from myssh.h:5:0,
from session.c:1:
/usr/include/libssh/libssh.h:489:31: note: declared here
SSH_DEPRECATED LIBSSH_API int ssh_get_publickey(ssh_session session, ssh_key *key);
Can ssh use a passphrase-protected private key?
I have an issue when I'm trying to ssh copy a complete local folder tree to a remote server.
Here is the skeleton code I used:
library(ssh)
session <- ssh_connect("<user>@<server.address>")
scp_upload(session, files = "~/<local_path>/<folder>", to = "~/<remote_folder>")
ssh_disconnect(session)
The problem is that files are recursively copied from "~/<local_path>/<folder>"
to "~/<remote_folder>/<folder>"
and not to "~/<remote_folder>"
as I would like to get.
Any hints are welcomed.
I am trying to connect to a web server (in this case, the status page for Presto database) that is accessible via SSH and am having trouble creating a tunnel. Creating the tunnel by calling ssh
directly works (note that host
and port
are in a hidden chunk of the reprex):
pid <- sys::exec_background(
"ssh",
args = c(host, "-L", glue::glue("{port}:localhost:{port}"), "-N")
)
Sys.sleep(2) # allow tunnel to be created
res <- httr::GET(glue::glue("http://localhost:{port}/ui/"))
httr::status_code(res)
#> [1] 200
tools::pskill(pid)
Created on 2020-05-26 by the reprex package (v0.3.0)
But creating the tunnel with ssh_tunnel()
does not work.
cmd <- glue::glue(
'session <- ssh::ssh_connect("{host}"); ',
'ssh::ssh_tunnel(session, port = {port}, target = "{host}:{port}")'
)
pid <- sys::exec_background("R", c("-e", cmd))
Sys.sleep(5)
res <- httr::GET(glue::glue("http://localhost:{port}/ui/"))
#> Error in curl::curl_fetch_memory(url, handle = handle): Recv failure: Connection reset by peer
httr::status_code(res)
#> Error in httr::status_code(res): object 'res' not found
tools::pskill(pid)
Created on 2020-05-26 by the reprex package (v0.3.0)
The error from GET()
is more descriptive when run interactively:
Error: libssh failure at 'channel_open_forward': Channel opening failure: channel 43 error (2) Connection refused
Execution halted
Warning message:
Disconnecting from unused ssh session. Please use ssh_disconnect()
Error in curl::curl_fetch_memory(url, handle = handle) :
Recv failure: Connection reset by peer
I would have expected the ssh_tunnel()
approach to be equivalent to directly calling ssh
. Curiously, I can use the ssh_tunnel()
approach to connect to a different host and service (RStudio Server) and get the message
/ Tunneled 448 bytes...tunnel closed!
One possibility is that ssh_tunnel()
eventually creates the tunnel using the string "localhost"
, which may be handled oddly by Presto? It seems that MySQL, for example, treats localhost
differently from 127.0.0.1
.
When I upload some files via scp_upload() everything works fine, but I always get an error message in the end:
Error in scp_upload(session, files, to = "/some/path/") :
Failed to open file FALSE
The files are uploaded nonetheless, just this message appears every time
I am using the ssh coding in a remote platform. With xshll, after connected, the prompt is [user@ip]$
, and when I input command SCALAstart
, it will be shift to scala platform with prompt scala>
, and then I can input the comman of scala code to manipulate the data. But when I used the ssh_exec_wait
in Rstudio, it also can get back the output in consol with scala>
, But the function is endless, and I can not sent the comman to the scala>
line, neither the new ssh_exec_wait function, nor the console input. So can I execute command withou waiting the returns, and execute new command while the last comman is running. And an additional function is prefer to return the out or error independently.
Hello,
I am learning to use your package and I follow your vignette. I'm at the Capturing output part. Before using the command R I must load the R program by doing module load R , but I get an error saying he can't find the command. While on the terminal of the remote machine I do not get an error
> library(ssh)
> session <- ssh_connect(host = "[email protected]", passwd = "test")
> ssh_exec_wait(session, command = "module load R")
bash: module load R: command not found
[1] 127
# out <- ssh_exec_internal(session, "R -e 'rnorm(10)'")
> ssh_disconnect(session)
> version
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 5.2
year 2018
month 12
day 20
svn rev 75870
language R
version.string R version 3.5.2 (2018-12-20)
nickname Eggshell Igloo
R-4.1.2, ssh-0.8.0, credentials-1.3.2, libssh-0.9.5
I'm using keepass (password manager) and its built-in SSH agent. This agent works for all of my command-line (ssh, scp, rsync) agent-accessing tools, as well as basic windows gui utilities (e.g., winscp). It provides two styles of socket files: cygwin and msysgit, neither of which seem to work with ssh_connect
, the use of either still results in R prompting me (using askpass
) for the remote password.
Sys.setenv(SSH_AUTH_SOCK="c:/Users/r2/.ssh/keeagent_cygwin.sock")
# Sys.setenv(SSH_AUTH_SOCK="c:/Users/r2/.ssh/keeagent_msys.sock")
file.exists(Sys.getenv("SSH_AUTH_SOCK"))
# [1] TRUE
sess <- ssh::ssh_connect("r2@remotex", verbose = TRUE)
ssh_config_parse_line: Unsupported option: IdentitiesOnly, line: 15
ssh_config_parse_line: Unsupported option: IdentitiesOnly, line: 21
ssh_config_parse_line: Unsupported option: IdentitiesOnly, line: 32
ssh_config_parse_line: Unapplicable option: ForwardX11, line: 40
ssh_config_parse_line: Unapplicable option: ForwardX11Trusted, line: 41
ssh_config_parse_line: Unapplicable option: ForwardX11, line: 46
ssh_config_parse_line: Unapplicable option: ForwardX11Trusted, line: 47
ssh_config_parse_line: Unapplicable option: LocalForward, line: 56
ssh_config_parse_line: Unapplicable option: LocalForward, line: 79
ssh_config_parse_line: Unapplicable option: LocalForward, line: 84
ssh_config_parse_line: Unapplicable option: LocalForward, line: 85
ssh_config_parse_line: Unapplicable option: LocalForward, line: 86
ssh_config_parse_line: Unapplicable option: LocalForward, line: 91
ssh_config_parse_line: Unapplicable option: LocalForward, line: 93
ssh_config_parse_line: Unapplicable option: LocalForward, line: 95
ssh_config_parse_line: Unapplicable option: LocalForward, line: 97
ssh_config_parse_line: Unapplicable option: LocalForward, line: 99
ssh_config_parse_line: Unsupported option: ForwardAgent, line: 121
ssh_config_parse_line: Unapplicable option: LocalForward, line: 125
ssh_config_parse_line: Unapplicable option: LocalForward, line: 131
ssh_config_parse_line: Unapplicable option: LocalForward, line: 132
ssh_config_parse_line: Unapplicable option: LocalForward, line: 137
ssh_config_parse_line: Unapplicable option: LocalForward, line: 139
ssh_config_parse_line: Unapplicable option: LocalForward, line: 141
ssh_config_parse_line: Unapplicable option: LocalForward, line: 143
ssh_config_parse_line: Unsupported option: ForwardAgent, line: 148
ssh_config_parse_line: Unsupported option: ForwardAgent, line: 172
ssh_config_parse_line: Unapplicable option: LocalForward, line: 174
ssh_config_parse_line: Unapplicable option: LocalForward, line: 175
ssh_config_parse_line: Unapplicable option: LocalForward, line: 181
ssh_config_parse_line: Unapplicable option: LocalForward, line: 183
ssh_config_parse_line: Unapplicable option: LocalForward, line: 188
ssh_config_parse_line: Unapplicable option: LocalForward, line: 193
ssh_config_parse_line: Unapplicable option: LocalForward, line: 195
ssh_config_parse_line: Unapplicable option: LocalForward, line: 199
ssh_config_parse_line: Unapplicable option: DynamicForward, line: 201
ssh_config_parse_line: Unsupported option: ForwardAgent, line: 212
ssh_config_parse_line: Unsupported option: ForwardAgent, line: 319
ssh_config_parse_line: Unapplicable option: ForwardX11, line: 321
ssh_config_parse_line: Unapplicable option: ForwardX11Trusted, line: 322
ssh_config_parse_line: Unsupported option: TCPKeepAlive, line: 325
ssh_config_parse_line: Unsupported option: ServerAliveInterval, line: 326
ssh_config_parse_line: Unsupported option: ServerAliveCountMax, line: 327
ssh_config_parse_line: Unsupported option: HashKnownHosts, line: 329
ssh_connect: libssh 0.9.5 (c) 2003-2019 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_socket_connect: Nonblocking connection socket: 1888
ssh_connect: Socket connecting, now waiting for the callbacks to work
socket_callback_connected: Socket connection callback: 1 (0)
ssh_client_connection_callback: SSH server banner: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
ssh_analyze_banner: Analyzing banner: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
ssh_analyze_banner: We are talking to an OpenSSH client version: 7.2 (70200)
ssh_known_hosts_read_entries: Failed to open the known_hosts file '/etc/ssh/ssh_known_hosts': No such file or directory
ssh_kex_select_methods: Negotiated [email protected],ecdsa-sha2-nistp256,aes256-ctr,aes256-ctr,[email protected],[email protected],[email protected],[email protected],,
ssh_init_rekey_state: Set rekey after 4294967296 blocks
ssh_init_rekey_state: Set rekey after 4294967296 blocks
ssh_packet_client_curve25519_reply: SSH_MSG_NEWKEYS sent
ssh_packet_newkeys: Received SSH_MSG_NEWKEYS
ssh_packet_newkeys: Signature verified and valid
Found known server key: 91:01:c0:4c:3d:c7:d6:80:b2:64:7a:f6:a0:13:16:65:d3:df:e9:8f
ssh_packet_userauth_failure: Access denied for 'none'. Authentication that can continue: publickey,password
ssh_packet_userauth_failure: Access denied for 'none'. Authentication that can continue: publickey,password
ssh_pki_import_pubkey_file: Error opening C:\Users\r2/.ssh/id_ed25519.pub: No such file or directory
ssh_pki_import_privkey_file: Error opening C:\Users\r2/.ssh/id_ed25519: No such file or directory
ssh_pki_import_pubkey_file: Error opening C:\Users\r2/.ssh/id_ecdsa.pub: No such file or directory
ssh_pki_import_privkey_file: Error opening C:\Users\r2/.ssh/id_ecdsa: No such file or directory
ssh_pki_import_pubkey_file: Error opening C:\Users\r2/.ssh/id_rsa.pub: No such file or directory
ssh_pki_import_privkey_file: Error opening C:\Users\r2/.ssh/id_rsa: No such file or directory
ssh_pki_import_pubkey_file: Error opening C:\Users\r2/.ssh/id_dsa.pub: No such file or directory
ssh_pki_import_privkey_file: Error opening C:\Users\r2/.ssh/id_dsa: No such file or directory
ssh_userauth_publickey_auto: Tried every public key, none matched
It does not connect to the socket file, instead asking me to type in my remote password. When I do that, it connects successfully. With no other changes, I can use the running agent from other (non-R) tools, so the agent is running and the respective keys are loaded and available.
KeeAgent has options to confirm with the user when a client requests a list of keys or retrieves a key. This prompting never occurs, so it appears (confirming what the log suggests) that there is no attempt to connect to the agent.
Am I doing something wrong?
Trying to connect to Postgress via ssh package (without any cmd commands); I get "Error: Authentication with ssh server failed."
Can anyone point me to a working example of using the newly launched ssh package?
I have been using your package for a while but recently I have not been unable to upload files from a windows computer to an Ubuntu computer. The code I had written worked last week, but since then I think there may have been some updates to Ubuntu. I am still able to use the ssh_exec_wait and scp_download. I attempted to use the scp_upload function sending the file to a Mac and it seems to work okay. Any help with fixing this would be much appreciated. Below is the error code and traceback
scp_upload(session,files=c('Start.tar.gz','condor.sub','mfcl.X86_64.LINUX.bat'),to="SKJ/GrowthStartingPoint/SamePhaseEst")
Error: Failed to create: SKJ/GrowthStartingPoint/SamePhaseEst (no such directory?)
traceback()
1: scp_upload(session, files = c("Start.tar.gz", "condor.sub", "mfcl.X86_64.LINUX.bat"),
to = "SKJ/GrowthStartingPoint/SamePhaseEst")
I am having an issue with ssh_connect()
when the username is in the form of an email address, eg:
keith@[email protected]
Error is
Error in parse_host(host, default_port = 22) :
host string contains multiple '@' characters
Is there a workaround? Thanks :)
See if we can somehow hookup SUDO_ASKPASS to libssh.
Hi,
I am trying to use this package on Mac High Sierra 10.13.2 with R 3.4.3 and libssh pulled with brew against a native Windows 10 client running a ssh server. Some commands, like, ping or whoami work fine, but many, like dir, do not. When it works, I get
ssh::ssh_exec_wait(sess, "whoami")
client2\administrator
[1] 0
but when it does not, I get
ssh::ssh_exec_wait(sess, "dir")
Error: libssh failure at 'ssh_channel_request_exec': Channel request exec failed
Any ideas?
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.
I am trying to write something that will use a session multiple times over relatively long times. When it is disconnected, I'd like to reconnect the session. But, when I run ssh_info()
on a disconnected session, it gives an error:
> ssh_disconnect(session)
> ssh_info(session)
Error in ssh_info(session) : ssh session has been disconnected
Could this behavior be changed so that it will return info about the session where $connected=FALSE
?
I think it would handy to have a function to list.files
before using scp_download
, as most of the time we want to check file paths before downloading them. I have created a function for my own use, which works pretty well but it is not flawless:
https://gist.github.com/jjesusfilho/083e1adabe261cd992accc65b5c855b1
I'm trying to establish SSH tunnel with port forwarding to access my PostgreSQL instance on AWS.
s <- ssh_connect("<username>@<jumpbox_host_IP>")
ssh_tunnel(s, port=5555, target = "<my_instance_address>:<port>")
I get the following message with spinning backslash/forwardslash and R session being on hold
| Waiting for connetion on port 5555 ...
It prevents me from running connection string command afterwards and start fetching the data using the following syntax from RODBC
and RPostgreSQL
packages.
conn <- RODBC::dbConnect(RPostgreSQL::dbDriver("PostgreSQL"), host = "127.0.0.1", user = "db_username>", port = 5555, dbname="<db_name>", password = "<db_password>")
dbListTables(conn)
- Session info -----------------------------------------------------------------------------------
setting value
version R version 3.5.2 (2018-12-20)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United Kingdom.1252
ctype English_United Kingdom.1252
tz Europe/Berlin
date 2019-03-12
- Packages ---------------------------------------------------------------------------------------
package * version date lib source
analogsea * 0.6.6.9110 2019-03-12 [1] Github (sckott/analogsea@26f3574)
assertthat 0.2.0 2017-04-11 [1] CRAN (R 3.5.2)
aws.s3 0.3.12 2018-05-25 [1] CRAN (R 3.5.2)
aws.signature 0.4.4 2018-07-27 [1] CRAN (R 3.5.2)
backports 1.1.3 2018-12-14 [1] CRAN (R 3.5.2)
base64enc 0.1-3 2015-07-28 [1] CRAN (R 3.5.2)
callr 3.1.1 2018-12-21 [1] CRAN (R 3.5.2)
cli 1.0.1 2018-09-25 [1] CRAN (R 3.5.2)
colorspace 1.4-0 2019-01-13 [1] CRAN (R 3.5.2)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.2)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.2)
devtools 2.0.1 2018-10-26 [1] CRAN (R 3.5.2)
digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.2)
dplyr 0.8.0.1 2019-02-15 [1] CRAN (R 3.5.2)
fs 1.2.6 2018-08-23 [1] CRAN (R 3.5.2)
ggplot2 * 3.1.0 2018-10-25 [1] CRAN (R 3.5.2)
glue 1.3.0 2018-07-17 [1] CRAN (R 3.5.2)
granviller * 0.0.0.9000 2019-03-02 [1] Github (mathesong/granviller@97673aa)
gtable 0.2.0 2016-02-26 [1] CRAN (R 3.5.2)
httr 1.4.0 2018-12-11 [1] CRAN (R 3.5.2)
jsonlite 1.6 2018-12-07 [1] CRAN (R 3.5.2)
lazyeval 0.2.1 2017-10-29 [1] CRAN (R 3.5.2)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.2)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.2)
munsell 0.5.0 2018-06-12 [1] CRAN (R 3.5.2)
pillar 1.3.1 2018-12-15 [1] CRAN (R 3.5.2)
pkgbuild 1.0.2 2018-10-16 [1] CRAN (R 3.5.2)
pkgconfig 2.0.2 2018-08-16 [1] CRAN (R 3.5.2)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.2)
plyr 1.8.4 2016-06-08 [1] CRAN (R 3.5.2)
prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.2)
processx 3.3.0 2019-03-10 [1] CRAN (R 3.5.3)
ps 1.3.0 2018-12-21 [1] CRAN (R 3.5.2)
purrr 0.3.1 2019-03-03 [1] CRAN (R 3.5.2)
R6 2.4.0 2019-02-14 [1] CRAN (R 3.5.2)
Rcpp 1.0.0 2018-11-07 [1] CRAN (R 3.5.2)
remotes 2.0.2 2018-10-30 [1] CRAN (R 3.5.2)
rlang 0.3.1 2019-01-08 [1] CRAN (R 3.5.2)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.2)
rstudioapi 0.9.0 2019-01-09 [1] CRAN (R 3.5.2)
scales 1.0.0 2018-08-09 [1] CRAN (R 3.5.2)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.2)
tibble 2.0.1 2019-01-12 [1] CRAN (R 3.5.2)
tidyselect 0.2.5 2018-10-11 [1] CRAN (R 3.5.2)
usethis 1.4.0 2018-08-14 [1] CRAN (R 3.5.2)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.2)
xml2 1.2.0 2018-01-24 [1] CRAN (R 3.5.2)
yaml 2.2.0 2018-07-25 [1] CRAN (R 3.5.2)
[1] C:/Users/mathe/OneDrive/Documents/R/win-library/3.5
[2] C:/Program Files/R/R-3.5.2/library
This issue is the followup from pachadotdev/analogsea#173 , where I was having issues with setting up a DigitalOcean docklet. Upon further inspection, I identified that the issue occurs within the ssh::ssh_connect()
function, and specifically at the following line:
.Call(C_start_session, details$host, details$port, details$user,
keyfile, passwd, verbose)
I will therefore close the other issue (thanks for the help @sckott )
Using the following code, I consisitently experience R crashing out:
library(analogsea)
docklet_create(region="ams3", image="ubuntu-16-04-x64")
d <- droplets()[[1]]
docklet_rstudio(d, user="test", password="test123", verbose=TRUE)
From the suggestion of @jeroen , I ran debug(ssh::ssh_connect), and set verbose=4 (it doesn't seem to support 5), and got the following log
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
getai: host 188.166.55.13 matches an IP address
ssh_socket_connect: Nonblocking connection socket: 1472
ssh_connect: Socket connecting, now waiting for the callbacks to work
ssh_connect: Actual timeout : 10000
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLOUT ), out buffer 0
ssh_socket_pollcallback: Received POLLOUT in connecting state
socket_callback_connected: Socket connection callback: 1 (0)
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLOUT ), out buffer 0
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLIN ), out buffer 0
callback_receive_banner: Received banner: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.7
ssh_client_connection_callback: SSH server banner: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.7
ssh_analyze_banner: Analyzing banner: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.7
ssh_analyze_banner: We are talking to an OpenSSH client version: 7.2 (70200)
ssh_known_hosts_read_entries: Failed to open the known_hosts file '/etc/ssh/ssh_known_hosts': No such file or directory
ssh_client_select_hostkeys: Changing host key method to "ssh-ed25519,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,ssh-rsa,ssh-dss"
ssh_list_kex: kex algos: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,ext-info-c
ssh_list_kex: server host key algo: ssh-ed25519,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,ssh-rsa,ssh-dss
ssh_list_kex: encryption client->server: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc
ssh_list_kex: encryption server->client: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc
ssh_list_kex: mac algo client->server: hmac-sha2-256,hmac-sha2-512,hmac-sha1
ssh_list_kex: mac algo server->client: hmac-sha2-256,hmac-sha2-512,hmac-sha1
ssh_list_kex: compression algo client->server: none
ssh_list_kex: compression algo server->client: none
ssh_list_kex: languages client->server:
ssh_list_kex: languages server->client:
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
packet_send2: packet: wrote [len=652,padding=5,comp=646,payload=646]
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLIN POLLOUT ), out buffer 0
ssh_packet_socket_callback: packet: read type 20 [len=972,padding=10,comp=961,payload=961]
ssh_packet_process: Dispatching handler for packet type 20
ssh_list_kex: kex algos: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
ssh_list_kex: server host key algo: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
ssh_list_kex: encryption client->server: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
ssh_list_kex: encryption server->client: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
ssh_list_kex: mac algo client->server: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
ssh_list_kex: mac algo server->client: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
ssh_list_kex: compression algo client->server: none,[email protected]
ssh_list_kex: compression algo server->client: none,[email protected]
ssh_list_kex: languages client->server:
ssh_list_kex: languages server->client:
ssh_kex_select_methods: Negotiated [email protected],ssh-ed25519,aes256-ctr,aes256-ctr,hmac-sha2-256,hmac-sha2-256,none,none,,
packet_send2: packet: wrote [len=44,padding=6,comp=37,payload=37]
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLOUT ), out buffer 0
ssh_socket_pollcallback: sending control flow event
ssh_packet_socket_controlflow_callback: sending channel_write_wontblock callback
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLIN ), out buffer 0
ssh_packet_socket_callback: packet: read type 31 [len=188,padding=8,comp=179,payload=179]
ssh_packet_process: Dispatching handler for packet type 31
ssh_packet_dh_reply: Received SSH_KEXDH_REPLY
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
packet_send2: packet: wrote [len=12,padding=10,comp=1,payload=1]
ssh_client_curve25519_reply: SSH_MSG_NEWKEYS sent
ssh_packet_socket_callback: Processing 112 bytes left in socket buffer
ssh_packet_socket_callback: packet: read type 21 [len=12,padding=10,comp=1,payload=1]
ssh_packet_process: Dispatching handler for packet type 21
ssh_packet_newkeys: Received SSH_MSG_NEWKEYS
crypt_set_algorithms2: Set output algorithm to aes256-ctr
crypt_set_algorithms2: Set HMAC output algorithm to hmac-sha2-256
crypt_set_algorithms2: Set input algorithm to aes256-ctr
crypt_set_algorithms2: Set HMAC input algorithm to hmac-sha2-256
ssh_pki_signature_verify: Going to verify a ssh-ed25519 type signature
ssh_packet_newkeys: Signature verified and valid
ssh_packet_socket_callback: Processing 96 bytes left in socket buffer
ssh_packet_socket_callback: packet: read type 7 [len=60,padding=6,comp=53,payload=53]
ssh_packet_process: Dispatching handler for packet type 7
ssh_packet_ext_info: Received SSH_MSG_EXT_INFO
ssh_packet_ext_info: Follows 1 extensions
ssh_packet_ext_info: Extension: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
ssh_connect: current state : 7
Found known server key: a2:b7:d8:4f:74:26:76:6c:25:42:09:03:6e:30:f0:7d:5d:16:11:25
packet_send2: packet: wrote [len=28,padding=10,comp=17,payload=17]
ssh_service_request: Sent SSH_MSG_SERVICE_REQUEST (service ssh-userauth)
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLOUT ), out buffer 64
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLOUT ), out buffer 0
ssh_socket_pollcallback: sending control flow event
ssh_packet_socket_controlflow_callback: sending channel_write_wontblock callback
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLIN ), out buffer 0
ssh_packet_socket_callback: packet: read type 6 [len=28,padding=10,comp=17,payload=17]
ssh_packet_process: Dispatching handler for packet type 6
ssh_packet_service_accept: Received SSH_MSG_SERVICE_ACCEPT
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
packet_send2: packet: wrote [len=44,padding=8,comp=35,payload=35]
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLOUT ), out buffer 0
ssh_socket_pollcallback: sending control flow event
ssh_packet_socket_controlflow_callback: sending channel_write_wontblock callback
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLIN ), out buffer 0
ssh_packet_socket_callback: packet: read type 51 [len=28,padding=12,comp=15,payload=15]
ssh_packet_process: Dispatching handler for packet type 51
ssh_packet_userauth_failure: Access denied for 'none'. Authentication that can continue: publickey
ssh_packet_userauth_failure: Access denied for 'none'. Authentication that can continue: publickey
ssh_userauth_publickey_auto: Trying to authenticate with C:\Users\mathe/.ssh/id_ed25519
ssh_pki_import_pubkey_file: Error opening C:\Users\mathe/.ssh/id_ed25519.pub: No such file or directory
ssh_pki_import_privkey_file: Error opening C:\Users\mathe/.ssh/id_ed25519: No such file or directory
ssh_userauth_publickey_auto: Private key C:\Users\mathe/.ssh/id_ed25519 doesn't exist.
ssh_userauth_publickey_auto: Trying to authenticate with C:\Users\mathe/.ssh/id_ecdsa
ssh_pki_import_pubkey_file: Error opening C:\Users\mathe/.ssh/id_ecdsa.pub: No such file or directory
ssh_pki_import_privkey_file: Error opening C:\Users\mathe/.ssh/id_ecdsa: No such file or directory
ssh_userauth_publickey_auto: Private key C:\Users\mathe/.ssh/id_ecdsa doesn't exist.
ssh_userauth_publickey_auto: Trying to authenticate with C:\Users\mathe/.ssh/id_rsa
ssh_key_algorithm_allowed: Checking rsa-sha2-512 with list <ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss>
ssh_key_algorithm_allowed: Checking rsa-sha2-512 with list <ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss>
ssh_socket_unbuffered_write: Enabling POLLOUT for socket
packet_send2: packet: wrote [len=604,padding=7,comp=596,payload=596]
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLOUT ), out buffer 0
ssh_socket_pollcallback: sending control flow event
ssh_packet_socket_controlflow_callback: sending channel_write_wontblock callback
ssh_socket_pollcallback: Poll callback on socket 1472 (POLLIN ), out buffer 0
ssh_packet_socket_callback: packet: read type 60 [len=572,padding=15,comp=556,payload=556]
ssh_packet_process: Dispatching handler for packet type 60
ssh_packet_userauth_pk_ok: Received SSH_USERAUTH_PK_OK/INFO_REQUEST/GSSAPI_RESPONSE
ssh_packet_userauth_pk_ok: Assuming SSH_USERAUTH_PK_OK
ssh_pki_import_privkey_base64: Trying to decode privkey passphrase=false
ssh_pki_openssh_import: Opening OpenSSH private key: ciphername: aes256-ctr, kdf: bcrypt, nkeys: 1
pki_private_key_decrypt: Decryption: 32 key, 16 IV, 16 rounds, zu bytes salt
At this point, my R crashes (by the way, please let me know if there's any sensitive information in the above log, so that I can remove it - I really don't know my way around these kinds of things).
From the unit tests within the ssh package, I can also reproduce this crash with the following
ssh <- ssh_connect('dev.opencpu.org', keyfile = 'C:/Users/mathe/.ssh/id_rsa')
I'd be very happy to try anything you can think of. But I am quite ignorant of how ssh works, as well as how to debug fatal errors, so I'm not really sure what else can or should be attempted here. Also, I'm not really sure how to offer any help about reproducing the issue, but would love to hear if anyone else is experiencing the same on Windows 10.
Thanks so much in advance for any help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.