- 2015.09.03
- read file from remote server (windows)
- install openssh
- download the latest version from http://www.mls-software.com/opensshd.html
- the blank should not be included in the path where you install it
- e.g. D:\OpenSSH
- create keys
- run 'cmd'
- d:
- cd OpenSSH
- cd bin
- ssh-keygen -t rsa
- it will tell you where the keys are created
- e.g. your identification has been saved in /home/admin/.ssh/id_rsa
- the real path is something like, C:\Users\admin\.ssh
- scp /home/admin/.ssh/id_rsa.pub <user name>@<host name>:
- ssh <user name>@<host name>
- if there is no .ssh directory
- mkdir .ssh
- chmod 700 .ssh
- cat id_rsa.pub >> .ssh/authorized_keys
- chmod 644 .ssh/authorized_keys
- exit
- ssh <user name>@<host name>
- it should not ask you to enter the password this time
- warning: unprotected private key file! / permissions 0xxx for 'path/to/id_rsa' are too open (OpenSSH)
- chmod 600 path/to/id_rsa
- try again
- run R/Rstudio
- install.packages("RCurl", dependencies = TRUE)
- require(RCurl)
- x = scp("host name", "/path/to/the/file", key=c("C:/Users/admin/.ssh/id_rsa.pub", "C:/Users/admin/.ssh/id_rsa"), user="user name", binary=F)
- or
- d <- read.table(pipe( 'ssh -l <user name> <host name> "cat /path/to/the/file"' ))
- install openssh
- read file from remote server (windows)
Wednesday, September 30, 2015
R
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.