1828983 Members
2199 Online
109986 Solutions
New Discussion

connecting FTP server

 
panchpan
Regular Advisor

connecting FTP server

Hello.
I have a ssh ftp server, when I try to connect it manually it works fine !
But when I use the same command in my shell script- It gives me an
error saying 'ftp error , Not Connected !' :-

sftp -n < /home/ftp.txt

ftp.txt:-
open
user password

Please advise.
Thank you.
4 REPLIES 4
Luk Vandenbussche
Honored Contributor

Re: connecting FTP server

To it like this

ftp.txt contains

sftp -n ServerIP
user userid
password password

run ftp.txt
panchpan
Regular Advisor

Re: connecting FTP server

I kept below in ftp.txt:-
sftp -n
user

Now, when I gave sh/ftp.txt - It says ftp.txt not found.

Please advise.
Luk Vandenbussche
Honored Contributor

Re: connecting FTP server

Hi,

Type

sh ./ftp.txt
panchpan
Regular Advisor

Re: connecting FTP server

Hello.
It gives me below error:-
sh ./ftp.sh
sftp: illegal option -- n
usage: sftp [-vC1] [-b batchfile] [-o ssh_option] [-s subsystem | sftp_server]
[-B buffer_size] [-F ssh_config] [-P sftp_server path]
[-R num_requests] [-S program]
[user@]host[:file [file]]
./ftp.sh[2]: user: not found.