aspose file tools*
The moose likes Linux / UNIX and the fly likes SFTP in unix shell script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "SFTP in unix shell script" Watch "SFTP in unix shell script" New topic
Author

SFTP in unix shell script

saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
Hi Everybody,

I know how to use ftp but i dont know how to use sftp.

I tried many times but unsuccessful

I searched in the google but couldn't get good appropriate stuff which is useful for me.

Please can any one help me how to use "sftp" in shell script

can any one provide me sample script

Please help me out!

Thanks!
Sai


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

To use SFTP, you need to be talking to an sftp-enabled server.

I normally use SCP myself, it requires that the receiving server be ssh-enabled and that you have a shell login.

SCP commands are fairly simple:

scp fromfile user@toserver:tofile

user and tofile are optional, as the defaults are your current user id and fromfile's filename, but if you forget the ":", scp will think you're just doing a local copy to a "tofile" named "toserver".

tofile is normally relative to "user"s home directory, but you can also copy to an absolute location on the serve, provided your account has appropriate security privileges.


Customer surveys are for companies who didn't pay proper attention to begin with.
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
NO boss
I need SFTP stuff that too with out interating with user while connecting to the server.
dont worry about ftp server.
I have ftp server :-)

Please help me out if any one knows about how to connect to ftp server using sftp (non-interactive)


Thnaks
sai
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
The Ganymed library implements SSH, SCP and SFTP. It's used in client applications such as Cyberduck, so I would imagine it to be rock-solid.


Ping & DNS - my free Android networking tools app
 
Consider Paul's rocket mass heater.
 
subject: SFTP in unix shell script