FTP command line username and password passing

Dear All,

I am new to unix and I am trying to build a shell script which will connect to a different server by passing username and password from a file or command line but not manually...

In short I dont want to connect to a diff server via ftp interactively.

Any suggestion...looking forward for your reply...

u can use -->> SSH: Secure Remote Login and Command Execution

SSH Command Line Utilities Usage Examples

If you want only to use ftp, you can use .netrc file in which you can save user name, IP address & password. So that when you connect, you will not be prompted for the same.

If you want to use SFTP, them I would suggest SFTP with public key authentication.

-Nithin.

Thanks to both of you.

@both

After login through ssh by the script I am not able to change the directory
Here is my script
#!/bin/bash
cd /export/home/xjanptak/bin/roaming/filijank/test/cookrie/
sqlplus testing/testing123 @cookrie.sql
sqlplus testing/testing123 @refresh.sql
ssh aslmuat3@s1tstd31
cd /export/home/aslmuat3/bin
ls
exit

This will work

#!/bin/bash
cd /export/home/xjanptak/bin/roaming/filijank/test/cookrie/
sqlplus testing/testing123 @cookrie.sql
sqlplus testing/testing123 @refresh.sql
ssh aslmuat3@s1tstd31 << EOF
cd /export/home/aslmuat3/bin
ls
exit
EOF

-Nithin

http://www.unix.com/unix-dummies-questions-answers/55155-ssh-password-command-line.html

try this i think this is what ur looking for .....

Thanks for your help.

But I want to know after connecting, how to change the directory.
the script is fine upto ssh command.
After that
cd /export/home/aslmuat3/bin
ls
this command not executing in the server I logged in via ssh.(s1tstd31)
After logging in I need to chng dir and run a script but not able to do the same..pls share your inputs

i mean you are not being able to change the directory and do listing ...

can u tell us what error message ur getting ???

try running ur script

blah.ksh >> log.txt
then open log.txt it will tell u wht error messages r there if u miss them on ur screen.

Hi dazdseg and bsnithin

Its working now...Thanks a lotttttttttttttttttt.....
just last qs how to run a sqlquery from a script for two hours.

In the logged server i have to run a sql script for two hour......:slight_smile: