LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-19-2002, 01:10 PM   #1
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Rep: Reputation: 15
A way to script file transfer from Linux to windows?


I have scripts setup to save critical data files in tarballs and transfer them to one or more computers on my LAN. I've been doing this for years - ever since I lost a hard disk once suddenly. Between Linux system this is easy to do using scp or rsync. My question is this: Is there a way to do this to a Windows machine?

I already have samba set up and can access the Windows machine via smbclient. But nothing I have read indicates any way to automate that process in a script. It seems to require user interaction. Is there a way to run smbclient in a script mode? Or perhaps ftp?

Regards,
Jeff
 
Old 11-19-2002, 02:16 PM   #2
KevinJ
Member
 
Registered: Feb 2001
Location: Colorado Springs, CO
Distribution: Redhat v8.0 (soon to be Fedora? or maybe I will just go back to Slackware)
Posts: 857

Rep: Reputation: 30
If you are running this as root, you can mount the Windows share and do a simple copy. That can all be scripted.

Or... you could set it up with an FTP server and use a script with the "ncftpput" command.

er, which way are you going? TO windows or FROM windows?

-K.
 
Old 11-19-2002, 03:12 PM   #3
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
Thanks for the reply. And, I'm sorry, I thought I said... TO windows. I do WORK on Linux. Windows is only good for storage. ;-)
 
Old 11-19-2002, 08:14 PM   #4
KevinJ
Member
 
Registered: Feb 2001
Location: Colorado Springs, CO
Distribution: Redhat v8.0 (soon to be Fedora? or maybe I will just go back to Slackware)
Posts: 857

Rep: Reputation: 30
I would just do something like this:
------------------------
#!/bin/sh

smbmount //192.168.0.50/winshare /mnt/smbtemp -o username=someuser password=somepassword

cp /home/myfiles.tar /mnt/smbtemp

umount /mnt/smbtemp
------------------------

then cron the creation of the tar and the above

-K.
 
Old 11-19-2002, 08:35 PM   #5
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
Hi Kevin;

I gave that a shot, but it came back saying:

smbmnt must be installed suid root for direct user mounts (500,500)
smbmnt failed: 1

I take it this would work if I was su, but I want to be able to run this script as a normal user.
 
Old 11-19-2002, 09:01 PM   #6
KevinJ
Member
 
Registered: Feb 2001
Location: Colorado Springs, CO
Distribution: Redhat v8.0 (soon to be Fedora? or maybe I will just go back to Slackware)
Posts: 857

Rep: Reputation: 30
If you can run an FTP server on Winbox, then use the "ncftput" command in a script. Of course, it requires that you have the ncftp package installed.

-K.
 
Old 11-19-2002, 09:54 PM   #7
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
I have ncftp installed. I'll have to look into what it takes to run an ftp server on the Win2k box. Thanks. I take it there's no way to get around the suid root requirement for smbmount? That would be a really slick way to do it. :-)
 
Old 11-19-2002, 11:51 PM   #8
KevinJ
Member
 
Registered: Feb 2001
Location: Colorado Springs, CO
Distribution: Redhat v8.0 (soon to be Fedora? or maybe I will just go back to Slackware)
Posts: 857

Rep: Reputation: 30
You could use "sudo".

"man sudo" for more info

-K.
 
Old 11-20-2002, 10:31 AM   #9
forand
Member
 
Registered: May 2002
Location: SF Bay Area
Posts: 54

Rep: Reputation: 15
I think there are also programs that will let you run an scp like server inside windows. Then you could use the scripts that you already have. I looked into this about a year ago and forgot most of what I wanted and concluded that I should just dump windows all together, I do remember that it was rather hard to find though. Good luck!
 
Old 11-21-2002, 11:51 AM   #10
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
Thanks, I'll look into that. The situation is rather amusing. Over the years I've discovered that one of the best ways to protect critical data is to copy it to several locations regularly. The machine on my LAN which is best suited for this physically is a dual-boot machine (Win2K/Linux) and I have no control over which the user will be operating at any given time. So, I'm trying to write a script which will detect which is booted and copy to an appropriate directory accordingly. Of course, when its booted in Linux, its trivial. I can tell when its booted in Win2k by a smbstatus call. If there were a way to script the smbmount from a normal user, I would have a solution. I'm not sure I want to use sudo, given all the security warnings (but I am going to look into it further).
 
Old 11-21-2002, 12:20 PM   #11
KevinJ
Member
 
Registered: Feb 2001
Location: Colorado Springs, CO
Distribution: Redhat v8.0 (soon to be Fedora? or maybe I will just go back to Slackware)
Posts: 857

Rep: Reputation: 30
"sudo" is designed for one thing... to allow normal users to do things that root is usually the only one allowed to do. That's EXACTLY what you are trying to do.

If implemented properly, it should not be a security hole.

-K.
 
Old 11-21-2002, 07:58 PM   #12
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
Okay - on your recommendation, I'll give it a try. :-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using BASH script to transfer a file via (s)ftp senther Linux - Newbie 2 07-19-2005 04:47 PM
there a way to transfer a file on linux to windows? e0r Linux - Newbie 4 02-21-2005 11:29 AM
ftping from a script file transfer incomplete Pelargonium Linux - Newbie 3 07-29-2004 12:56 PM
file transfer from linux to xp michi56 Linux - Newbie 5 03-07-2004 12:26 PM
Linux/Windows file transfer: Possible? Fudge T Goblin Linux - Newbie 6 09-17-2003 11:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration