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.
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?
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.
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.
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.
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.
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
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:
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.
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.
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
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.
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
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.