[SOLVED] Is there any other way to transfer file from windows to linux without using samba
Linux - GeneralThis 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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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/
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?
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.
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.
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
WinSCP (Windows Secure CoPy) is a free and open sourceSFTP, 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;
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.