Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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 username@remote.server.com:/path/to/folder/* 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 username@remote.server.com:/path/to/folder/* 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.