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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
06-12-2012, 05:36 AM
|
#1
|
|
LQ Newbie
Registered: Jun 2012
Posts: 4
Rep: 
|
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
|
|
|
|
06-12-2012, 05:46 AM
|
#2
|
|
Senior Member
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 2,806
|
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?
|
|
|
|
06-12-2012, 06:59 AM
|
#3
|
|
Moderator
Registered: Aug 2002
Posts: 10,707
|
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.
|
|
|
|
06-15-2012, 06:54 AM
|
#4
|
|
LQ Newbie
Registered: Jun 2012
Posts: 4
Original Poster
Rep: 
|
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
|
|
|
|
06-15-2012, 07:53 AM
|
#5
|
|
Moderator
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,088
|
Moved: This thread is more suitable in Linux-General and has been moved accordingly to help your thread/question get the exposure it deserves.
|
|
|
|
06-16-2012, 01:35 PM
|
#6
|
|
Moderator
Registered: Aug 2002
Posts: 10,707
|
What linux distribution are you running?
Is your windows computer running XP or 7?
What is the name of your windows share?
|
|
|
|
06-16-2012, 02:49 PM
|
#7
|
|
Guru
Registered: Mar 2008
Posts: 8,561
|
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.
|
|
|
|
06-17-2012, 03:02 AM
|
#8
|
|
Member
Registered: Jun 2012
Location: Canada
Distribution: Ubuntu/Debian/CentOS
Posts: 45
Rep:
|
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
|
|
|
|
06-17-2012, 10:58 AM
|
#9
|
|
Moderator
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 10,358
|
Member Response
Hi,
Look at ' winscp.net' for a MS utility. More at Wikipedia;
putty on the MS machine will provide a secure shell; HTH!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:13 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|