Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am investigating various options for writing a program that can automate download of files on a SSH server. I need it to auomatically log in, navigate to different directories and download all files from there.

However, upon further thinking, it seems to me it may be easier to use puTTy commandline to download all files from various folders to my own Windows computer.

I currently have a root account which I don't really want. (Afraid something can go wrong and I will be to blame.) Could I ask the server administrator to provide me with a limited account only with read priviledge - and only to those directories? Would puTTty still work or does it require something special on the SSH server to work? If so, that would be #1 way for me to solve my client's problem.

share|improve this question

WinSCP is a good client for file transfer over SSH, and can work from windows cli or gui.

as for rights, no you don't need root to ssh, and if they reduce your privileges but grant you the required permissions on the files you need, that should work just fine for you. personally I don't allow root login via ssh, but I don't tend to run distros that enable a root account by default.

share|improve this answer
Thanks for your answer. I have upvoted it for now. More than anything I need commandline though. But I will check out WinSCP :) – Tom Mar 13 '13 at 13:33
winscp can be used via cli, so its just a matter of taste in clients. – Frank Thomas Mar 13 '13 at 17:48

The putty suite of utilities includes pscp which is equivilent to the openssh scp command. You could use it like this:

pscp -pw password* c:\local\folder

This will copy all the remote files in the folder specified to the local folder, and would not require anything special on the remote end, aside from permitting the limited user ssh access, and access to the folder.

You would probably want to look into using public/private keys to avoid the need to put the password into your scripts - the second answer to this question shows you how.

Then you would use

pscp -i /path/to/private.key* c:\local\folder

To do this, the user account would have to have a /home/username/.ssh/authorized_keys file, and the ssh server would have to permit public key authentication.

share|improve this answer
This appears to be an ideal solution. I will leave the quesion open for some time to receive more answers. (But I suspect I will be marking this as the answer.) I upvoted your answer for now :) – Tom Mar 13 '13 at 13:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .