LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-12-2012, 05:36 AM   #1
pranjal_815
LQ Newbie
 
Registered: Jun 2012
Posts: 4

Rep: Reputation: Disabled
Unhappy Is there any other way to transfer file from windows to linux without using samba


Hi guys,

This is my first post.

I am looking to transfer file from windows machine to linux machine.

But the problem is that I am not to sure about the method that I am using.

Please suggest me a best way to do this also if anyone find error in my script please let me know or correct it.

#
#!/bin/bash
ssh -q serverip//D$/Pranjal/Test/
mount -t cifs //serverip/Pranjal/Test/ /home/pranjal/backup/ -o username=administrator,password=lockpicking

ssh -q serverip///home/pranjal/backup/
cp *.cta /home/pranjal/backup/
cd /home/pranjal/backup/
cp *.asp D$/Pranjal/Test/
cd -
umount D$/Pranjal/Test/


Regards,
Pranjal
 
Old 06-12-2012, 05:46 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,897

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
I'm not really sure, but on windows you can have a hostname and sharename: so \\hostname\sharename is valid, \\serverip\Pranjal\Test looks invalid for me. so probably your syntax is incorrect. Have you tried what you wrote? is there any error message?
 
Old 06-12-2012, 06:59 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,727

Rep: Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919
Welcome to LinuxQuestions.

What linux distribution are you running?

There are several methods available to transfer files between computers without using samba. Your script does not make sense since you are mixing SSH with samba and it actually looks like you want to copy files from linux to windows.

It looks like your windows share name is D$/Pranjal/Test/ so to mount it the correct syntax is:
mount -t cifs //serverip/D$/Pranjal/Test/ /home/pranjal/backup -o username=administrator,password=lockpicking

Depending on the distribution you must be logged in as root or use sudo.

You can then use the cp command to copy files to /home/pranjal/backup.

Last edited by michaelk; 06-12-2012 at 07:01 AM.
 
Old 06-15-2012, 06:54 AM   #4
pranjal_815
LQ Newbie
 
Registered: Jun 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Smile Thanks to all

Hi Guys,

pan64 when i run this script the file gets copied from the window location on the linux server location but I did get an error after wards which I guess occurs after this command :

mount -t cifs //serverip/Pranjal/Test/ /home/pranjal/backup/ -o username=administrator,password=lockpicking

could anyone more serialize the script as I feel like that the following line does not make any sense as when I run the script without executing the following no changes is noticed :

ssh -q serverip///home/pranjal/backup/
cp *.cta /home/pranjal/backup/
cd /home/pranjal/backup/
cp *.asp D$/Pranjal/Test/
cd -
umount D$/Pranjal/Test/



Also let create a group and post some good script related query so that we can share each other knowledge.



@ michaelk
please will you like to edit my script or improve my script as I am new to script writing also please highlight the changes make.


I will be waiting for your response.

Regards,
Pranjal
 
Old 06-15-2012, 07:53 AM   #5
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Moved: This thread is more suitable in Linux-General and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 06-16-2012, 01:35 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,727

Rep: Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919
What linux distribution are you running?
Is your windows computer running XP or 7?
What is the name of your windows share?
 
Old 06-16-2012, 02:49 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
If you want to fix ssh then it may be used.

Any other the other ways to transfer a file may work too. telnet, rcp, scp, ftp, tftp are examples.

Tools like putty and such make it easier.

Could use http pages to move files if you have a server on.

Windows has some simple usb type no install programs from portableapps.com A fileserver or http server can be set up in seconds.

All of this may need file based permission, or user permission or firewall opened.
 
Old 06-17-2012, 03:02 AM   #8
montel
Member
 
Registered: Jun 2012
Location: Canada
Distribution: Ubuntu/Debian/CentOS
Posts: 45

Rep: Reputation: 19
Im going to keep this short since im on my phone... But from what it looks like, what you want to accomplish does not need ssh in your bash script. Lets lay it out a different way.

This should be all you need for the script:

#!/bin/bash
#mount the windows share
mount -t cifs //serverip/Pranjal/Test/ /mnt/data -o username=administrator,password=lockpicking
#copy from the windows share to the backup directory.
cp *.cta /mnt/data/ /home/pranjal/backup/
cp *.asp /mnt/data/ /home/pranjal/backup/
#unmount the windows share.
umount /mnt/data

If this doesn't make sense or there is a syntax error somewhere, ill fix it in the morning when im on a computer. Hope this help you.

Last edited by montel; 06-17-2012 at 02:46 PM. Reason: Spelling and Comments
 
Old 06-17-2012, 10:58 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member Response

Hi,

Look at 'winscp.net' for a MS utility. More at Wikipedia;
Quote:
WinSCP (Windows Secure CoPy) is a free and open source SFTP, SCP, and FTP client for Microsoft Windows. Its main function is secure file transfer between a local and a remote computer. Beyond this, WinSCP offers basic file manager and file synchronization functionality. For secure transfers, it uses Secure Shell (SSH) and supports the SCP protocol in addition to SFTP. It received 5 out of 5 stars for CNET editors' rating, and is ranked #2 in popularity for FTP software.[1]
Development of WinSCP started around May 2000 and continues. Originally it was hosted by the University of Economics in Prague, where its author worked at the time. Since July 16, 2003 it is licensed under the GNU GPL and hosted on SourceForge.net.
WinSCP is based on the implementation of the SSH protocol from PuTTY and FTP protocol from FileZilla. It is also available as a plugin for two file managers, FAR and Altap Salamander.
putty on the MS machine will provide a secure shell;
Quote:
excerpt from putty wiki;

PuTTY is a free and open source terminal emulator application which can act as a client for the SSH, Telnet, rlogin, and raw TCP computing protocols and as a serial console client. The name "PuTTY" has no definitive meaning,[1] though "tty" is the name for a terminal in the Unix tradition, usually held to be short for Teletype.
PuTTY was originally written for Microsoft Windows, but it has been ported to various other operating systems. Official ports are available for some Unix-like platforms, with work-in-progress ports to Classic Mac OS and Mac OS X, and unofficial ports have been contributed to platforms such as Symbian[2][3] and Windows Mobile.
HTH!
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
transfer file from linux to windows aggrishabh Linux - Newbie 5 01-18-2011 01:02 PM
transfer a csv file from windows to linux uxan Fedora 1 08-30-2007 02:04 AM
there a way to transfer a file on linux to windows? e0r Linux - Newbie 4 02-21-2005 11:29 AM
Linux/Windows file transfer: Possible? Fudge T Goblin Linux - Newbie 6 09-17-2003 11:12 AM
A way to script file transfer from Linux to windows? jkcunningham Linux - Networking 11 11-21-2002 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:23 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