Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have two Ubuntu boxes and want to share files and printer between them. I'm reading about Samba but I have a question: Is Samba only for sharing thing between Ubuntu and Windows? Another question: There is a lot of information describing hot to share files and printer between Ubuntu and Windows, but what about two Ubuntu boxes? How can I do that? Is there how-to I can follow?

share|improve this question

4 Answers 4

up vote 14 down vote accepted

Use NFS to share file between systems if there is no windows involved, it is so easy.

Install nfs-kernel-server Install nfs-kernel-server and nfs-common Install nfs-common on the computer that has the files to be shared. These can be installed in the Software Center, or however you prefer to install packages. You can install them on the command-line with:

sudo apt-get update && sudo apt-get install nfs-kernel-server nfs-common

You need to edit the exports file that shows what to share and with whom. So run:

gksu gedit /etc/exports

For example, to give full read and write permissions, allowing any computer from 192.168.1.1 through 192.168.1.255, add this line to /etc/exports:

/directory_to_share 192.168.1.1/24(rw,no_root_squash,async)

My daughter's export file looks like this (I am .201--we are not using a range, just one IP):

/home           192.168.0.201(rw,sync,no_root_squash,no_subtree_check)
/srv/nfs        192.168.0.201(rw,sync,no_subtree_check)

Restart the NFS server by running:

sudo /etc/init.d/nfs-kernel-server restart

(Or just reboot the computer.)

From now on after editing the /etc/exports file, you can just run sudo exportfs -a to apply the changes.

The showmount cmommand will tell you that all went well--for example, on my daughter's computer, it shows she will share these two things with my computer @ .201 (me) if requested

$ showmount -e
Export list for jamie-desktop:
/srv/nfs 192.168.0.201
/home    192.168.0.201

Then install nfs-common Install nfs-common on the computer that wants to mount the export shares as part of its file system.

An fstab entry must be added to have your computers nfs-client mount another computers exports @ boot time. gksu gedit /etc/fstab will edit the required file.

 192.168.0.200:/srv/nfs  /media  nfs  rsize=8192 and wsize=8192,noexec,nosuid

Reboot and the share is mounted in /media.

Set up a server on the client and client on the server for two-way shares.

You can print to a shared printer with CUPS (as mentioned in this answer).

share|improve this answer
1  
NFS are a classic, but SSH are more modern, secure and flexible today. With SSH you can use the GUI-dialog in Nautilus to do the mounting. –  Anders Wallenquist Apr 23 '12 at 14:50
    
Please read Do Not Use the no_root_squash Option –  Nabil Kadimi Jan 8 at 11:59

For sharing files between Linux/Unix hosts over a trusted network NFS is usually the best option.

share|improve this answer
    
Use SSH and you don't have to know if you can trust the network or not. –  Anders Wallenquist Apr 23 '12 at 14:51

You can use Samba the same way to share between 2 Ubuntu machines.

Alternatively, you can also use CUPS directly to share printers, and one of the other supported network filesystems to share files (or if you have a SSH server set up, just use sftp:// in Nautilus).

One possible advantage of using Samba is that it will also work if you ever need to share something with a Windows or Mac OS X user (e.g. a visitor with a laptop).

share|improve this answer
    
Samba are for Windows-users, if its Ubuntu-only SSH are a better solution. –  Anders Wallenquist Apr 23 '12 at 14:52

You can use the built in Ubuntu One for file sharing easy and straight forward to setup.

This article should help with sharing printer, but it is mostly dependent on the brand of the printer as well.

Goodluck.

share|improve this answer
    
Whilst U1 will work for this, there are better ways. Unless you want/need to share with some one who you want to be able to simply configure any machine for access to the data you are sharing, I would stick to SAMBA/NFS/SSH –  thecoshman Jan 7 '13 at 8:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.