Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

mount linux directory

Posted on 2008-06-25
13
1,016 Views
Last Modified: 2013-12-06
I've got 2 linux boxes and I like to transfer files between them.  They both have ftpd and httpd running and I use those sometimes to get a file from one to the other.  More often I use scp to copy files between boxes.

What I want to do now is share a folder on one PC and mount it on the other so I can access it as if it was local.  Is samba the only way to accomplish this task???  I thought that samba was used to create windows shares on a linux box, and/or connect to windows shares from a linux box.  But here there are no windows involved so I would like to use something else, something pure linux.

Thanks!
0
Comment
Question by:brasslan
  • 3
  • 3
  • 2
  • +3
13 Comments
 
LVL 19

Expert Comment

by:http:// thevpn.guru
ID: 21869674
You can use samba in both ways...another way to do it would be to use NFS shares.
0
 
LVL 6

Author Comment

by:brasslan
ID: 21869989
oh ya, I knew there was another way besides samba.  Do you know how to create the NFS share, and the syntax to mount it?  Or maybe have any links for some reading material for NFS?

Thanks!
0
 
LVL 19

Accepted Solution

by:
http:// thevpn.guru earned 100 total points
ID: 21870013
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 14

Assisted Solution

by:agriesser
agriesser earned 100 total points
ID: 21872582
If you're familiar with scp and like SSH, you can even use sshfs.
Usually, it's easy as 1-2-3 to setup, just install the package "sshfs" if it isn't already installed, and afterwards, run this command to mount any directory from the remote system.

sshfs ssh-user@ssh-server:/remote/directory /local/mount-point

The command above mounts the directory /remote/directory on ssh-server in your directory /local/mount-point, authentication with user "ssh-user" on the other server (ssh-server).

To unmount this directory again, use:

fusermount -u /local/mount-point
0
 
LVL 1

Assisted Solution

by:packetgod
packetgod earned 50 total points
ID: 21875414
You can do SCP/SSHFS if you want to wait forever, it is great if you are working over untrusted links but it has to encrypt everything and decrypt it on the other side.  If you are talking larger amounts of data over a local link NFS is totally the way to go.

Steps to do it are fairly simple, first make sure it is installed on the system you are using (different methodologies for different boxes.

Then edit your /etc/exports file and add in a line like this:
/home/me/somedirectoryiwanttoshare 192.168.1.1/255.255.255.255(rw,async,no_root_squash,no_subtree_check)

So that would be the directory you want to share followed by an IP or range of IPs you want to access it followed by a parenthesis and RW or RO for read write or read only followed by a bunch of other junk.

Hope that helps.
0
 
LVL 1

Expert Comment

by:packetgod
ID: 21875443
Sorry, forgot one other step.  After you edit your /etc/exports file and write it I do a /etc/init.d/nfs-kernel-server restart

That may look different on your system depending on your flavor of linux.  Look for something in /etc/init.d that starts with NFS.
0
 
LVL 29

Expert Comment

by:Michael Worsham
ID: 21875938
Another option would be to setup iSCSI on both boxes and have it point to a 'shared' iSCSI data volume.
http://www.cyberciti.biz/tips/rhel-centos-fedora-linux-iscsi-howto.html

Or if you want to get a bit more complicated, look at using GFS or OCFS2:
http://www.centos.org/docs/5/html/5.2/pdf/Global_File_System.pdf
http://oss.oracle.com/projects/ocfs2/
0
 
LVL 8

Expert Comment

by:eager
ID: 21876664
Setting up nfs is simple.

The system with the directory you want to share is the server.  Make sure that the nfs server is installed and started when your server system boots up.  Also make sure that any firewall on the server system allows NFS connections.

Create /etc/exports.  The simplest format is
  /path/to/shared/directory     *(rw)

This says to share the directory with everyone on the network as a read-write directory.

Restart nfs on the server, or enter "sudo exportfs -a".  

On the client, first, make sure that you can mount the directory.  Enter
  sudo server:/path/to/shared/directory /path/on/client

Naturally, replace the paths with the correct names and make sure that the mount point on the client exists. If this works, you should be able to cd to /path/on/client and see the shared directory. if there is a failure, check paths, firewall, etc.  

Add the following to the line to /etc/fstab on the client:
  server:/path/to/shared/directory  /path/on/client   nfs  defaults  0 0

There are many more options available in NFS, but this should get you going.  
0
 
LVL 14

Expert Comment

by:agriesser
ID: 21877923
@packetgod:

Have you read the sshfs manpage or do you simply dislike SSHFS because of it's name?
There are several disadvantages of NFS over SSHFS and any other shared filesystems but that's not the topic in here. But it's simply untrue that SSHFS is slow.

You can enable compression (does NFS support compression on the fly?) and you can use a fast cipher instead of a very strong one so packets get compressed first and afterwards encrypted with a fast cipher which will definetly transfer the packet faster to the other end (and even on large files, it will be faster than using FTP or NFS in some instances).

Of course, NFS is a good solution for the author's question but SSHFS is also a good solution (especially if you consider that even the LAN in an office could be an untrusted network depending on the size of the company and the co-workers in there).

0
 
LVL 1

Expert Comment

by:packetgod
ID: 21878198
@ agriesser:

I actually think SSHFS is really very cool and have used it regularly, I just never thought to reduce the Cipher strength to make it faster.  It certainly does add significant flexibility over NFS and ease of use through firewalls.  Although compression only really helps with compressable file formats and adds to your processor load as now it is doing both compression/decompression and encryption/decryption, perhaps with newer processors it isn't really an issue but I can see some hits on my older machines.

Of course most of my uses of SSHFS have been over untrusted links so I don't think I'd actually want to use a weaker cipher but I tend to use NFS for local and SSHFS for remote   Certainly weak encryption over a local link will most likely be sufficient for your security and file sharing needs.
0
 
LVL 14

Expert Comment

by:agriesser
ID: 21878346
I didn't want to sound rude, I just wanted to clarify the reason why I suggested SSHFS, I hope you didn't get me wrong in this one.

After all, it's up to the author of this question to choose what file sharing mechanisms is the best to choose in his environment.
0
 
LVL 6

Author Comment

by:brasslan
ID: 22446376
Oops, I forgot to close this one out...

Thanks everyone for all of your help!!!
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VPS for routing recomendations 3 65
number in printf 13 32
Remove Resilio directory from Netgear ReadyNAS 212 via SSH. 2 47
The better OS Architecture 13 66
The purpose of this article is to demonstrate how we can use conditional statements using Python.
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question