Help with a script to transfer files from Solaris to windows


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with a script to transfer files from Solaris to windows
# 15  
Old 08-15-2016
Quote:
Originally Posted by hicksd8
If you're doing this on the Unix box and it's connecting to a Windows box why does it say "Remote system is type UNIX"?
I'd expect to see "Remote system is Windows".

Anybody know why that would happen?
I've just downloaded the latest filezilla server onto my Windows box and yes it says Remote system type is UNIX. Looking at the filezilla console you get the message 215 UNIX emulated by FileZilla. Mystery solved?

Stupid question directed at original poster: Did you set up any users within the filezilla server? Using your windows accounts will not work. You have to add username/password/home directory to filezilla.

Andrew
This User Gave Thanks to apmcd47 For This Post:
# 16  
Old 08-15-2016
Hi

I have used the following on a different server:
Code:
 ftp 192.168.1.19
Connected to 192.168.1.19.
220 Microsoft FTP Service
Name (192.168.1.19:root): emm
331 Password required for emm.
Password:
230 User emm logged in.
Remote system type is Windows_NT.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for file list.
CHARGINGSYSTEM
GGSN
SGSN
SMSC
SMSGw
exodus.241115
software
226 Transfer complete.
66 bytes received in 0.00017 seconds (382.51 Kbytes/s)
ftp> put collect.sh
200 PORT command successful.
150 Opening ASCII mode data connection for collect.sh.
226 Transfer complete.
local: collect.sh remote: collect.sh
1288 bytes sent in 0.009 seconds (140.27 Kbytes/s)
ftp> by
221

So it worked

But on the very same server using the script:

Code:
#!/bin/sh
HOST=192.168.1.19
USER=emm
PASSWD=emm
#printf "PASSWD is $PASSWD \n

/usr/bin/ftp -inv  <<EOF
connect $HOST
user $USER $PASSWD

binary
mput *.sh
bye
EOF

the result is:
Code:
./ftpfiles.sh
?Invalid command
Not connected.
Not connected.
Not connected.

# 17  
Old 08-15-2016
As apmcd47 has already said, don't try to put userid/passwd credentials in the script. Put a .netrc file in the home directory under which the script is running. As already said, make sure you get the access rights set read-only for the owner.

Once you've done that typing ftp <hostname> from the command line should just connect instantly.
# 18  
Old 08-15-2016
my home directory of my unix server does not have that file! Should I create?

Code:
 echo $HOME
/moneta_home
bash-3.00$ ls -al
total 6
drwxr-xr-x   2 root     root         512 May 27  2011 .
drwxr-xr-x  80 root     root        2048 Aug 15 10:12 ..
You have new mail in /var/mail/moneta
bash-3.00$

# 19  
Old 08-15-2016
Yes, create a file called .netrc in your home directory.

Put one line in it like this:

machine <ftp target name> login <remote login user> password <password>

Set the file so you own it, and with your main group
Set the mask to 600

Make sure the ftp target name also appears in /etc/hosts with its correct ip address.

Then, when you run "ftp <nodename>" it will look up the name in /etc/hosts to get the ip address, then look for .netrc and if the target node is listed it will use the userid and password from there to connect via ftp. It should just connect instantly without asking for credentials.

None of the above requires a reboot.
# 20  
Old 08-15-2016
this is what I did:

Code:
echo $HOME/.netrc
//.netrc
You have new mail in /var/mail/root
root@moneta # ls -al .netrc
.netrc: No such file or directory
root@moneta #

them vi:

Code:
machine 192.168.1.19 login emm password emm

them:
Code:
chmod 0600 ~/.netrc

them tested:

Code:
ftp 192.168.1.19
Connected to 192.168.1.19.
220 Microsoft FTP Service
331 Password required for emm.
230 User emm logged in.
Remote system type is Windows_NT.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for file list.
CHARGINGSYSTEM
GGSN
SGSN
SMSC
SMSGw
collect.sh
exodus.241115
software
226 Transfer complete.
78 bytes received in 0.00048 seconds (159.66 Kbytes/s)
ftp> put vmstat.dat
200 PORT command successful.
150 Opening ASCII mode data connection for vmstat.dat.
226 Transfer complete.
local: vmstat.dat remote: vmstat.dat
8111 bytes sent in 0.016 seconds (507.89 Kbytes/s)
ftp> by
221


them using the script:

Code:
#!/bin/sh
HOST=192.168.1.19

/usr/bin/ftp -inv  <<EOF
connect $HOST
user $USER $PASSWD

binary
mput *.sh
bye
EOF

them the error:

Code:
./ftpfiles.sh
?Invalid command
Not connected.
Not connected.
Not connected.
You have new mail in /var/mail/root
root@moneta #

using command line works, does not work on the script
# 21  
Old 08-15-2016
Quote:
Originally Posted by fretagi
this is what I did:

...

them vi:

Code:
machine 192.168.1.19 login emm password emm

them:
Code:
chmod 0600 ~/.netrc

them tested:

...


them using the script:

Code:
#!/bin/sh
HOST=192.168.1.19

/usr/bin/ftp -inv  <<EOF
connect $HOST
user $USER $PASSWD

binary
mput *.sh
bye
EOF

them the error:

Code:
./ftpfiles.sh
?Invalid command
Not connected.
Not connected.
Not connected.
You have new mail in /var/mail/root
root@moneta #

using command line works, does not work on the script
Try:
Code:
#!/bin/sh
HOST=192.168.1.19

/usr/bin/ftp -inv $HOST <<EOF

binary
mput *.sh
bye
EOF

Andrew
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to transfer files from Solaris to windows

Hi All Please can you help, I´ve wrote the following script on a solaris 10 server to transfer files to a windows machine. #!/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... (7 Replies)
Discussion started by: fretagi
7 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