You might try setting up ssh so that you do not need a password. See man ssh-keygen
In essence, you make a key for the machine you are on with (for example): ssh -t dsa which produces a public and a private key. You upload the public key to remoteserver.com, and put it in your .ssh directory by adding it to (or creating) a file called authorized_keys, e.g. cat id_dsa.pub >> .ssh/authorized_keys When you are asked for a passphrase, leave it blank. Then you don't need to enter your username or password in order to connect. This assumes that remoteserver.com runes linux or unix. If not, I have no idea what to do. My impression is that this method is no less secure on the whole than using passwords. (I do it with the full knowledge of our security-obsessed computing staff.) Jon On 04/08/10 22:01, afoo wrote: > > Hi, > > I am trying to SSH to a remote server through R script. In other words, I > would like to know how I can get a SSH connection to the remote server and > then execute commands on that server with the R script. > > So in bash, I would normally type ssh -lusername remoteserver.com; press > enter and then wait for the password prompt to key in my password. > > I have tried system("ssh remoteserver.com") but that doesn't work because, > from what I know, SSH requires user interactivity - I am required to key in > my password. > > I tried looking up about putting password as a command line parameter, but > SSH doesn't allow that, my only option then is to set up a private/public > key pair. But the admin of the remoteserver doesn't allow me to do that. > > Is there a way in which I can SSH in? Or is there a command in R that allows > me to interact with the command prompts interactively? > > thanks, > afoo > -- > View this message in context: > http://n4.nabble.com/SSH-Through-R-Script-tp1809635p1809635.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron Editor: Judgment and Decision Making (http://journal.sjdm.org) ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.