Script to transfer files from Solaris to windows


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to transfer files from Solaris to windows
# 1  
Old 02-23-2015
Script to transfer files from Solaris to windows

Hi All

Please can you help, I´ve wrote the following script on a
Code:
solaris 10

server to transfer files to a windows machine.

Code:
#!/usr/bin/sh

cd /moneta_polled01/download

HOST=10.100.4.72
USER=user1
PASSWD=V7stop

/usr/bin/ftp -v $HOST <<EOF
user $USER $PASSWD
cd tmp
binary
put test.txt
bye
EOF

but when I run it, I got the following:

Code:
./get_sdp.sh
Connected to 10.100.4.72.
220-FileZilla Server version 0.9.49 beta
220-written by Tim Kosse (tim.kosse@filezilla-project.org)
220 Please visit https://filezilla-project.org/
Name (10.100.4.72:root): 331 Password required for user user1 v7st
Password:
530 Login or password incorrect!
Login failed.
Remote system type is UNIX.
530 Please log in with USER and PASS first.
530 Please log in with USER and PASS first.
530 Please log in with USER and PASS first.
530 Please log in with USER and PASS first.
221 Goodbye

Please can you tell me if there is anything wrong with the script
# 2  
Old 02-23-2015
Well, without wishing to be cruel, it looks like your credentials are wrong. Can you do this interactively before we try to automate it?

I've fallen over this myself as we have Windows domains to consider. If the account you are trying to connect to is a domain wide account rather than an account local to the server, you need to qualify it. You might try variations like this for your USER value:-
Code:
USER="mydomain/user1"
USER="mydomain\/user1"
USER="mydomain\\user1"
USER="mydomain\\\\user1"

The extra \ characters are because the / & \ may be getting interpreted by your shell script and when they are fed into the actual ftp it's getting lost.

I've had different variations for different target servers. No idea why the variation.


Looking again closely at your output, the prompt being sent is 331 Password required for user user1 v7st which also suggests that you might need to break the input, so instead of user $USER $PASSWD you might need:-
Code:
user $USER
$PASSWD




I hope that one of these helps,
Robin
# 3  
Old 02-23-2015
Hi

I´ve tried all the options all the options you suggested but did not work, and all of them prompt me for a password, and if you look closely, the first letter of PASSWD=V7stop, in one of the lines converts the first letter of the password to small caps

Last edited by rbatte1; 02-23-2015 at 07:53 AM.. Reason: Changed CODE tags to ICODE tags
# 4  
Old 02-23-2015
I had not noticed that either. Is the variable PASSWD defined elsewhere as a lower-case string with a typeset -l command, perhaps in the calling script or environment.

Can you embed:-
Code:
PASSWD=V7stop
ROBIN=V7stop

printf "PASSWD is $PASSWD \n"
printf "ROBIN  is $ROBIN  \n"

.... and see if that illustrates where the problem might be.



Robin
# 5  
Old 02-23-2015
I am lost now:

Code:
PASSWD=V7stop
ROBIN=V7stop

printf "PASSWD is $PASSWD \n"
printf "ROBIN  is $ROBIN  \n"

Code:
 ./teste1.sh
PASSWD is V7stop
ROBIN  is V7stop

# 6  
Old 02-23-2015
Perhaps alter the ftp command to add the -i & -n flags to give you this:-
Code:
#!/usr/bin/sh

cd /moneta_polled01/download

HOST=10.100.4.72
USER=user1
PASSWD=V7stop
printf "PASSWD is $PASSWD \n"

/usr/bin/ftp -inv <<EOF
connect $HOST
user $USER $PASSWD
cd tmp
binary
put test.txt
bye
EOF

The -i flag is used to turn off prompting when you use an mget or an mput and the -n avoids the automatic login using .netrc if you have one.

I'm not sure, but let us know whether this helps. Smilie



Robin
# 7  
Old 02-23-2015
Now its much better, but still failed:

Code:
 ./test_sdp.sh
PASSWD is V7st
Connected to 10.100.4.72.
220-FileZilla Server version 0.9.49 beta
220-written by Tim Kosse (tim.kosse@filezilla-project.org)
220 Please visit https://filezilla-project.org/
Remote system type is UNIX.
331 Password required for user1
530 Login or password incorrect!
Login failed.
530 Please log in with USER and PASS first.
?Invalid command
530 Please log in with USER and PASS first.
530 Please log in with USER and PASS first.
530 Please log in with USER and PASS first.
221 Goodbye
root@moneta #

As you can see, the first line after script name, the
Code:
password

is not correct, the correct
Code:
password

is "V7stop" and not "V7st". But on the script is set correctly
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with a script to transfer files from Solaris to windows

Hi Please can you tell me what could be wrong with the following scriptto transfer files from solaris 10 to windows machine: #!/bin/sh HOST=<IP> USER=administrator PASSWD=xyz123zyx /usr/bin/ftp -inv <<EOF connect $HOST user $USER $PASSWD cd Documents binary mput *.sh bye EOF (23 Replies)
Discussion started by: fretagi
23 Replies

2. Solaris

Transfer files from windows to solaris with winscp (file protocol:SFTP)

Hello, I have a couple of zip files to be copied from my local drive to a folder in solaris10 residing in a VM ware. i am using WINSCP, I tried to get hold of the solaris hostname or ip using ifconfig -a , hostname|nslookup etc. when i create a new session in WINSCP using that IP and port... (6 Replies)
Discussion started by: herbich1985
6 Replies

3. UNIX for Dummies Questions & Answers

transfer windows files to linix

I'm very new to linix (using puppy) and need to transfer some files on the same computer from windows to linix. Please use small easy words (2 Replies)
Discussion started by: bugzy
2 Replies

4. Shell Programming and Scripting

Shell Script to transfer files from unix to windows

I have to transfer a file from unix to windows through Shell Script. I am using the below script, but it is not working. Please help. Please note --- I have to transfer the file from unix to windows. Not from windows to unix. I mean I don't have to use batch script.Only through unix shell script.... (1 Reply)
Discussion started by: vsachan
1 Replies

5. Solaris

File transfer from Windows to Solaris.

I have a file on my desktop which is windows based. I make a telnet session with a Solaris machine that too with root access by using putty. I want to transfer a file there on Solaris machine. Is there a mean to transfer this file on solaris machine. If now can it be known by using telnet... (6 Replies)
Discussion started by: nixhead
6 Replies

6. HP-UX

Transfer Files from Windows to HP-UX

I need to transfer files from Windows to Hp-UX box with out any software(Filezilla ...., Fsecure file transfer) Is it possible to transfer using command prompt ? (6 Replies)
Discussion started by: girija
6 Replies

7. Shell Programming and Scripting

Unable to transfer files from Windows 2000 Server to Sun Solaris..

Dear Friends, I need to transfer few files from a Windows 2000 server to Sun Solaris system, connected in the same network. This copy should be done as a batch job without asking for password to be entered every time. How to make this possible ??? At present I am using cygwin in my laptop... (4 Replies)
Discussion started by: ks_reddy
4 Replies

8. Solaris

Transfer files from Solaris to windows

Please let me know a efficient way to transfer files from a solaris to a windows machine. Total size of data is 800GB. (3 Replies)
Discussion started by: pingmeback
3 Replies

9. UNIX for Advanced & Expert Users

How to transfer files from Unix to Windows.

Hi There is a requirement for me to transfer files from Unix to windows in an automation process of unix. Please let me know is it posibble to shell scripting this? Could you help me in scripting it? Regards Venugopal (2 Replies)
Discussion started by: venu_eie
2 Replies

10. Shell Programming and Scripting

shell script to transfer files from Unix to Windows

I need to write a shell script to transfer files from Unix server to windows machine. This script will be scheduled on scheduler to run at specified intervals #!/bin/ksh ftp -n alaska <<End-Of-Session user sss01 sample cd /home/sss01 lcd D:/sample mget *.txt bye when I executed the... (15 Replies)
Discussion started by: knag
15 Replies
Login or Register to Ask a Question