sharing files between Desktop (Windows) and Laptop (Linux)

sgleo87

Member
Oct 25, 2005
139
0
0
I recently installed Suse 10.0 on my laptop and I think I am going to make it my main OS and eventually delete my windows partition. I have Windows on my desktop and will probably stay with it for another while until I figured everything out in Linux and also because of playing games which only run on Windows. I share all of my files between my laptop and desktop through my router because I need the documents, music, etc on both computers and it is also a nice backup if something happens to one of the computers. My question is if it is possible to share files between a Linux and a Windows PC? Or do I have to switch to Linux on my desktop; is file sharing between to Linux PCs as easy as it is with Windows?
 

niomosy

Junior Member
Dec 27, 2005
20
0
0
Yup, Samba's the way to go. Depending on which way you want to go, you can either share your desktop and mount it to your laptop or vice versa. Samba shares directories as Windows shares, basically. Samba for Linux also includes a client for mounting Windows shares.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
I don't know much about Linux to Windows file sharing, since I don't have a Windows box to try it out on (which I should fix), but samba is generally the way to go.

For Linux to Linux it depends on what you want.

If you want to host files on one computer to be used on the other, then samba is what you'd probably want. There is also NFS and other things like OpenAFS, but I think that samba is going to be the most popular.

For just occasional file transfer using ssh is very simple. It's setup by most distros by default and using that you can log into other ssh-serving computers and transfer files about.

You have a few choices..
ssh remote.comp
allows you to log into the command line of that computer, assuming 'remote.comp' is the dns name of the computer you want to access. (You can also use the ip address or put the computer's name in your /etc/hosts file.)

ssh remote.comp "command -k whatever"
runs a command on that remote computer

If you edit /etc/ssh/sshd_config to allow X11 transfer over ssh, and then restart the ssh service (so that it rereads the configuration file) then you can go..

ssh -X remote.comp "firefox"
and it will open the firefox browser on your local computer, but actually have it running (using cpu and memory) on the remote computer. I used to use this to check my email. It works over the internet, but it's slow. (there are ways to make it fast though) Also you don't get any acceleration.

Also if you want to log in as a different user or whatnot...
ssh username@remote.comp

also with ssh you have two command line things for transfering files...
scp /home/username/filename remote.comp:/tmp/
scp remote.comp:/tmp/filename ~/

It works like cp, but it's for 'ssh' so it's ssh or secure cp, or just scp.

Then there is sftp that emulates ftp protocol, but in a ssh-using fasion.

Also if your using Gnome you can open up the file manager in 'browser mode' or open up a nautilus window and hit 'ctrl-l' and into the browser you put:
sftp://remote.comp/home/username/
and hit enter and it should make it like a psuedo-directory on your desktop you can use.

It works so-so for me. Sometimes I have to add my username..
sftp://username@remote.comp/home/username/

I am sure that KDE has something similar.

This stuff works best if you setup a public/private keypair for ssh so that you don't have to keep typing your password all the time.


Also keep in mind that ssh adds encryption and the files (and X) are tunnelled through ssh. This increases CPU load and overhead so that file transfers are slower then using something like samba. But it's secure enough to use over untrusted networks (ie the internet) and it doesn't require a lot of setup.

It's good for occasional file transfers.

Another thing that you can use is 'unison-gtk'. Which is the gui front end to unison. Unison- works similar to 'rsync' if your familar with that, except that instead of simply mirroring two directories, you use it to keep 2 directories in sync. That is it will help you decide how to mirror files that have both been accessed since the last time they've been compared.

I use it for keeping my home directory's syncronized between my laptop and my desktop. So that way when I am using my laptop everything is setup the same way and all my files in my home directory are the same.

First time you run it it is dead slow. Takes forever to generate a database on your directories. After that then it goes faster. It has a hard time doing large files in a quick way, and if you have deleted very large files then it will seem to hang... The solution is to keep big files out of the directories you want to mirror or tell it to ingore certain directories. Also I use it to keep my email in sync, but you have to be carefull not to check email on one machine and then check the email on the other machine before using unison to match them up.

It'll display the changes and such to make it easier but it still sucks to have to manually copy emails around to make sure that you don't loose anything important. As long as you keep these limitations in mind then it works fine.

But like they said, if you want to host files on one computer to be used on the other computer then samba is great. If you want to be able to transfer files from Linux to Windows over the network then samba is great.
 

niomosy

Junior Member
Dec 27, 2005
20
0
0
Originally posted by: drag
If you want to host files on one computer to be used on the other, then samba is what you'd probably want. There is also NFS and other things like OpenAFS, but I think that samba is going to be the most popular.

Samba's the most popular for end-users, casual users and smaller shops. For large, corporate shops, NFS as many of us supporting Linux come from a Unix background and are used to Solaris, AIX, HP-UX, etc.

Samba's still the best choice for this request, though ;)