LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 04-26-2003, 08:50 PM   #1
d_lake
Member
 
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.

Thanks
 
Old 04-26-2003, 09:00 PM   #2
angelrod
Member
 
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:

http://www.samba.netfirms.com/

http://www.samba.org

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
miknight
Member
 
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
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

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

NFS, FTP, HTTP, SSH...

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.



Links:
FTP Server
HTTP Server
Open SSH
NFS Tools

HTH

Cool
 
Old 04-26-2003, 11:14 PM   #5
d_lake
Member
 
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
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
samba, like the first guy said.
 
Old 04-27-2003, 04:42 AM   #7
mcleodnine
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
Nukes
Member
 
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
d_lake
Member
 
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.

Thanks
 
Old 04-27-2003, 05:58 PM   #10
miknight
Member
 
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
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
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:

Code:
# 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
fi
# 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:

Code:
# 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 <volkerdi@slackware.com>.

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:
    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:
    exit
  fi

  # 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
  fi

  echo "Starting NFS services:"

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

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

  # 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
  fi

  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"
      /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
    fi
  fi

  # 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"
    /usr/sbin/rpc.lockd
  fi

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

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() {
  nfsd_stop
  sleep 1
  nfsd_start
}

case "$1" in
'start')
  nfsd_start
  ;;
'stop')
  nfsd_stop
  ;;
'restart')
  nfsd_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
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.:

/data 192.168.1.3(rw)

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

Code:
# 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"
  /sbin/rpc.portmap
fi
# 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:
192.168.1.20:/data      /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
Aussie
Senior Member
 
Registered: Sep 2001
Location: Brisvegas, Antipodes
Distribution: Slackware
Posts: 4,590

Rep: Reputation: 58
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
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
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:
http://lufs.sourceforge.net/lufs/

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
miknight
Member
 
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
tgschaef
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!
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:50 PM.

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