Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 04-26-2003, 08:50 PM   #1
Registered: Feb 2003
Location: Alabama
Distribution: Slackware
Posts: 43

Rep: Reputation: 15
linux file sharing

I want to know how do you share a linux dir. and be able to access it from another linux machine.

Old 04-26-2003, 09:00 PM   #2
Registered: Oct 2002
Location: Mexico
Distribution: RedHat 9.0 and SuSE 8.1
Posts: 229

Rep: Reputation: 30
Yo have to install and configure samba first. You can find some usefull information here:

If you have never configured samba before i recommend you to get "webmin", it will make your life much easier.

Good Luck!
Old 04-26-2003, 10:12 PM   #3
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
If it's between linux machines is it really necessary to use samba? Shouldn't there be other ways of doing it? I've heard of NFS - is that a viable method?
Old 04-26-2003, 10:19 PM   #4
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
You have other options as well...


How do you want to access, that would narrow your list down a bit. If you want your linux directory to appear as just another directory on your other linux box you should look at ssh or NFS. If you want to share this directory to many other people, maybe ftp. If you wish to do something fancy with it, maybe http.

FTP Server
HTTP Server
Open SSH
NFS Tools


Old 04-26-2003, 11:14 PM   #5
Registered: Feb 2003
Location: Alabama
Distribution: Slackware
Posts: 43

Original Poster
Rep: Reputation: 15
I want to like just go through konqueror and see a directory that is shared from another linux machine, or something similar to that.
Old 04-27-2003, 04:04 AM   #6
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971
samba, like the first guy said.
Old 04-27-2003, 04:42 AM   #7
Senior Member
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731

Rep: Reputation: 45
I'd use NFS (like the second guy said )

Or if you want to go to extremes you could have a look at coda and openafs. Coda is promoted to be a more stable networkfs and has features like local imaging. openafs has greater control via access control lists.
Old 04-27-2003, 08:41 AM   #8
Registered: Apr 2003
Location: Scotland UK
Distribution: Gentoo
Posts: 92

Rep: Reputation: 15
Yeah, Samba or NFS is what you need, you just mount them with a mount command just like any other filesystem. Go for samba if you want interoperability with windows machines. It also seems a fair bit easier than NFS to set up, but I havej't had much experience with NFS.
Old 04-27-2003, 10:38 AM   #9
Registered: Feb 2003
Location: Alabama
Distribution: Slackware
Posts: 43

Original Poster
Rep: Reputation: 15
Ok, if use samba to do linux-to-linux file sharing, how exactly do i set samba up to do that. Just to let you know I have never been able to figure out how to set up samba correctly.

Old 04-27-2003, 05:58 PM   #10
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
If it's Slackware you're running, I think you just need to make the /etc/rc.d/rc.samba file executable (chmod +x /etc/rc.d/rc.samba) - that will make samba startup on boot providing you then create a smb.conf file (easiest by using the sample one provided).

To do this I *think* you just copy the /etc/samba/smb.conf-sample (is that what it's called?) file to smb.conf in the same dir.

Then you need to edit it to suit your needs (configure samba and set up shares)... it's probably a good idea to find a good samba howto on this.

Finally you can then choose to mount remote shares (using smbmount or mount -t smbfs) or just to browse to them in konqueror by going smb://computername

Hmm, probly best to read to the docs.
Old 04-27-2003, 06:20 PM   #11
LQ Guru
Registered: Jan 2001
Posts: 24,147

Rep: Reputation: 229Reputation: 229Reputation: 229
Alright guys, lets get the right information to this guy and lets not tell him to setup samba to share between two Linux machines, but do it the correct way.

NFS should be used to share between Linux machines.
Samba should be used to setup shares between a Linux and a Windows machines.

Slackware is easy to setup to perform this if you installed NFS:

Machine 1 - To setup as the NFS server to share out a specific directory.

1. Edit your /etc/rc.d/rc.inet2 file and make sure you have these lines uncommented or specified in this file:

# This must be running in order to mount NFS volumes.

# Start the NFS server.   Note that for this to work correctly, you'll
# need to load the knfsd module for kernel NFS server support.
# You'll also need to set up some shares in /etc/exports.
# Starting the NFS server:
if [ -x /etc/rc.d/rc.nfsd ]; then
  /etc/rc.d/rc.nfsd start
# Done starting the NFS server.
2. Now make sure you actually have the rc.nfsd start up script as well in /etc/rc.d which should look like this:

# This is an init script for the knfsd NFS daemons.
# To use NFS, you must first set up /etc/exports.
# See exports(5) for information on /etc/exports format.
# Written for Slackware Linux by Patrick J. Volkerding <>.

nfsd_start() {
  # Sanity checks.  Exit if there's no /etc/exports, or if there aren't any
  # shares defined in it.
  if [ ! -r /etc/exports ]; then # no config file, exit:
  elif fgrep '/' /etc/exports 1> /dev/null 2> /dev/null ; then
    true # there are directories listed in /etc/exports, continue:
  else # no shares listed in /etc/exports, exit:

  # First, make sure the nfsd kernel module is loaded.  You can comment this
  # part out if you've built nfsd support directly into the kernel.
  if [ -z "`/sbin/lsmod | grep "^nfsd "`" ]; then
    /sbin/modprobe nfsd

  echo "Starting NFS services:"

  if [ -x /usr/sbin/exportfs ]; then
    echo "  /usr/sbin/exportfs -r"
    /usr/sbin/exportfs -r

  if [ -x /usr/sbin/rpc.rquotad ]; then
    echo "  /usr/sbin/rpc.rquotad"

  # Start 8 nfsd servers by default (an old Sun standard):
  if [ -x /usr/sbin/rpc.nfsd ]; then
    echo "  /usr/sbin/rpc.nfsd 8"
    /usr/sbin/rpc.nfsd 8

  if [ -x /usr/sbin/rpc.mountd ]; then
    # Test for NFS version 3 so we can offer it if it's there:
    /usr/sbin/rpcinfo -u localhost nfs 3 1> /dev/null 2> /dev/null
    if [ $? = 0 ]; then # we have NFSv3, so start rpc.mountd offering it:
      echo "  /usr/sbin/rpc.mountd"
    else # start rpc.mountd with only NFSv2, not NFSv3.
      echo "  /usr/sbin/rpc.mountd --no-nfs-version 3"
      /usr/sbin/rpc.mountd --no-nfs-version 3

  # NFS file locking services.  These are optional but recommended.

  # With newer kernels, this starts by itself, but this won't hurt:
  if [ -x /usr/sbin/rpc.lockd ]; then
    echo "  /usr/sbin/rpc.lockd"

  if [ -x /usr/sbin/rpc.statd ]; then
    echo "  /usr/sbin/rpc.statd"

nfsd_stop() {
  killall lockd 2> /dev/null
  killall rpc.statd 2> /dev/null
  killall rpc.mountd 2> /dev/null
  killall nfsd 2> /dev/null
  sleep 1
  killall -9 nfsd 2> /dev/null # make sure :)
  killall rpc.rquotad 2> /dev/null
  /usr/sbin/exportfs -au 2> /dev/null

nfsd_restart() {
  sleep 1

case "$1" in
  echo "usage $0 start|stop|restart"
3. Now you'll want to setup the directory you intend to share in /etc/exports.

It will go in a format something like this giving first the directory to share out, the IP address of the machine your giving access to along with the type of permissions as well. man exports for more details.:


You can also specify the hostname instead of the IP if you add the machine your sharing this directory out to in your /etc/hosts file. Its a good idea to go ahead and add this host to your hosts file.

4. Now you want to either start NFS or restart if its already running, so it recognizes all the changes.

Now on to Machine 2 - The client machine you want to access the share from the server.

1. First edit your /etc/rc.d/rc.inet2

# This must be running in order to mount NFS volumes.
# Start the RPC portmapper:
if [ -x /sbin/rpc.portmap ]; then
  echo "Starting RPC portmapper:  /sbin/rpc.portmap"
# Done starting the RPC portmapper.

# At this point, we are ready to talk to The World...

# Mount remote (NFS) filesystems:
echo "Mounting remote (NFS) file systems:  /sbin/mount -a -t nfs"
/sbin/mount -a -t nfs            # This may be our /usr runtime!
# Show the mounted volumes:
/sbin/mount -v -t nfs
# Done mounting remote (NFS) filesystems.
2. To have this automount at boot time.. edit your /etc/fstab file after first creating an empty directory in lets say /mnt called nfs-share, and place a line like this in the fstab file:

Code:      /mnt/nfs-share      nfs     rsize=8192,wsize=8192,timeo=14
And that should be pretty much all you need to do. From there you should find your share in Konq in /mnt/nfs-share. This all depends on if you've installed NFS from the initial install, which I'm sure you have.

Let us know, but you don't need to mess with samba for a Linux to Linux share, that's for Windows to Linux.
Old 04-27-2003, 11:35 PM   #12
Senior Member
Registered: Sep 2001
Location: Brisvegas, Antipodes
Distribution: Slackware
Posts: 4,590

Rep: Reputation: 56
Tricky is correct, you should only use samba when you have a mixed win/linux network, for a linux only network use nfs.
Once it's setup correctly you can add the shared directory to your /etc/fstab and mount it at boot.

[Edit: I really should stop skimming long posts.]

Last edited by Aussie; 04-27-2003 at 11:36 PM.
Old 04-28-2003, 12:15 AM   #13
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 47
If you want to help test the first step in the next generation of distributed file system access, check out the Linux Userland FileSystem module and tools at:

It will allow you to give clients access to your data through a variety of ways, including ssh and ftp. It requires little set up on the server side (apart from what I would consider basic system setup such as an ssh or ftp server, which has probably already been done).

[edit] Although it's still in beta version numbers, their ssh client access is quite complete and robust, as is, I think, their ftp client.

Last edited by moses; 04-28-2003 at 12:21 AM.
Old 04-28-2003, 04:31 AM   #14
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
I'm gonna check out that LUFS thing moses suggested because I also agree Samba should not be used unless WIndows is involved. I've also heard some bad stuff about NFS
Old 04-28-2003, 07:02 AM   #15
LQ Newbie
Registered: Apr 2003
Location: Holland, MI
Distribution: Redhat 8.0
Posts: 5

Rep: Reputation: 0
Question Windows and Linux accessing Linux...

How about this situation at my home. I have a linux router/web server/file server (hard working P200!) defending us from the internet and providing a central place for downloads, music, pictures, and automatic data backups. On the protected side I have two Win2k machines and a dual boot WinXP/Redhat 8.0. I have samba running on the router sharing drive space and a printer and everything's great for the client windows guys and even Redhat can successfuly connect using Samba.

Now my question is more of a philosophical one. In this situation of a mix of windows and linux accessing a linux box, should I set both Samba and NFS up to share the same shares so each OS can connect using their "native" method? Or would that be more trouble than it's worth? If Samba works and even though it was intended for windows<->linux file sharing, what is the "philosophical" reason against using it for Linux to Linux file sharing?

Just some thought provoking questions for everyone!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
File Sharing Linux and OS X hitsuzen Linux - Newbie 1 09-26-2004 11:46 AM
File sharing in Linux... Fernando534 Linux - Networking 2 05-12-2004 02:22 PM
linux file sharing paulr1984 Linux - Networking 4 05-11-2004 09:33 AM
File sharing in Linux... Norrin Linux - Newbie 12 11-20-2003 01:59 AM
File Sharing Linux and XP rsb99 Linux - Networking 7 02-05-2003 12:43 PM

All times are GMT -5. The time now is 08:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration