Open romanhaa opened 7 years ago
I have done multi-hop ssh with forwarding in the past but it's been a while. This should be possible - see, for example, the second answer to this question here: https://superuser.com/questions/96489/an-ssh-tunnel-via-multiple-hops
Hi,
I got it to work with the SGE cluster I have access by taking advantage of the names of the compute machines in our SGE cluster. All nodes start with compute
. So this is what I have:
Host sge
User my_username
Hostname my_cluster@somewhere
LocalForward 4321 localhost:4321
ForwardX11 yes
ForwardX11Trusted yes
I guess that forwarding X11 is there for historical reasons, or in case that rmote
fails and you don't want to have to restart your terminal.
ForwardX11 yes
ForwardX11Trusted yes
Set up local forwarding for all compute nodes in my SGE cluster. This http://pentestmonkey.net/cheat-sheet/ssh-cheat-sheet was useful to me btw because I tried first with RemoteForward
.
Host compute*
LocalForward 4321 localhost:4321
Force all different terminal windows to use the same server_dir
for start_rmote()
so that they all update in the same location.
## rmote for images
# https://github.com/cloudyr/rmote
installed <- require('rmote')
if(!installed) {
cat('install.packages("rmote", repos = c(CRAN = "http://cran.rstudio.com",
tessera = "http://packages.tessera.io"))')
} else {
start_rmote(port = 4321, server_dir = '/users/my_username/rmote/rmote_server')
## This also works
# start_rmote(port = 4321, server_dir = paste0('/users/my_username/rmote/rmote_server_', Sys.Date()))
}
rm(installed)
In reality I chose a different number from 4321
for the port, so that it won't conflict with other users if they use the default value in rmote::start_rmote()
.
Best, Leo
> options(width = 120); devtools::session_info()
Session info ----------------------------------------------------------------------------------------------------------
setting value
version R version 3.4.3 Patched (2018-01-20 r74142)
system x86_64, linux-gnu
ui X11
language (EN)
collate en_US.UTF-8
tz US/Eastern
date 2018-02-16
Packages --------------------------------------------------------------------------------------------------------------
package * version date source
base * 3.4.3 2018-01-20 local
colorout * 1.1-2 2017-08-10 Github (jalvesaq/colorout@020a14d)
colorspace 1.3-2 2016-12-14 CRAN (R 3.4.1)
compiler 3.4.3 2018-01-20 local
datasets * 3.4.3 2018-01-20 local
devtools 1.13.4 2017-11-09 CRAN (R 3.4.2)
digest 0.6.15 2018-01-28 cran (@0.6.15)
ggplot2 2.2.1 2016-12-30 CRAN (R 3.4.1)
graphics * 3.4.3 2018-01-20 local
grDevices * 3.4.3 2018-01-20 local
grid 3.4.3 2018-01-20 local
gtable 0.2.0 2016-02-26 CRAN (R 3.4.1)
htmltools 0.3.6 2017-04-28 CRAN (R 3.4.1)
htmlwidgets 0.9 2017-07-10 CRAN (R 3.4.1)
httpuv 1.3.5 2017-07-04 CRAN (R 3.4.1)
lattice 0.20-35 2017-03-25 CRAN (R 3.4.3)
lazyeval 0.2.1 2017-10-29 CRAN (R 3.4.2)
memoise 1.1.0 2017-04-21 CRAN (R 3.4.1)
methods * 3.4.3 2018-01-20 local
mime 0.5 2016-07-07 CRAN (R 3.4.1)
munsell 0.4.3 2016-02-13 CRAN (R 3.4.1)
pillar 1.1.0 2018-01-14 CRAN (R 3.4.2)
plyr 1.8.4 2016-06-08 CRAN (R 3.4.1)
png 0.1-7 2013-12-03 CRAN (R 3.4.1)
Rcpp 0.12.14 2017-11-23 CRAN (R 3.4.2)
rlang 0.1.6 2017-12-21 CRAN (R 3.4.2)
rmote * 0.3.4 2018-02-16 deltarho (R 3.4.3)
scales 0.5.0 2017-08-24 CRAN (R 3.4.1)
servr 0.8 2017-11-06 CRAN (R 3.4.3)
stats * 3.4.3 2018-01-20 local
tibble 1.4.1 2017-12-25 CRAN (R 3.4.2)
tools 3.4.3 2018-01-20 local
utils * 3.4.3 2018-01-20 local
withr 2.1.1 2017-12-19 CRAN (R 3.4.2)
PS I found about this project thanks to https://community.rstudio.com/t/feature-request-send-plots-from-r-in-terminal-to-plots-pane/1877/3
This repository looks fantastic. Would be great to use it at work, but unfortunately after SSHing onto the remote cluster I have to log onto one of our nodes to do the work. I followed your tutorial and suspect that this additional step could be the reason why I can't get it to work at the moment. Instead, in R I get this kind of output after reloading the localhost:4321 website (which doesn't refresh on its own for me):
Just asking in case you have some experience with this kind of environment. I apologise if this is not enough information to understand what the problem is. If so, let me know and I'll explain in a bit more detail later.
Thanks!