LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-17-2017, 07:40 AM   #1
mikedelo
Member
 
Registered: Mar 2004
Location: Staten Island, NY
Distribution: Fedora
Posts: 42

Rep: Reputation: 0
Creating a network drive


Hello!

I am hoping you can help guide me in the right direction. I have a desktop and a laptop, both running Ubuntu Mate on the same WiFi network at home. I would like to create a network drive on my laptop that connects to my home directory on my desktop - only when I am at home. How can I accomplish this?

Thank you so much!
 
Old 07-17-2017, 08:37 AM   #2
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 9 Stretch
Posts: 1,922
Blog Entries: 7

Rep: Reputation: 269Reputation: 269Reputation: 269
There are a few ways to do this. An nfs share is good for performance and ease, but it's less secure (unless you set it up to use nfsv4). An sshfs share is more secure, but you'll have to either enter your password every time you want to connect or you'll want to set up password-less key based authentication.

Here's the nfs method:

- - - nfs share - - -

On server, run the following commands:
Code:
sudo apt-get install nfs-kernel-server
sudo vi /etc/exports
Use vi (or something else) to edit /etc/exports to include the following line:
Code:
/home/myuserhomedir/ *(rw,async,no_root_squash,no_subtree_check)
sudo service nfs-kernel-server restart
sudo service idmapd restart[/code]
Replace "myuserhomedir" with your home directory.

On client, run the following commands:
Code:
mkdir ~/remhome
sudo apt-get install nfs-common
vi /etc/fstab
Use vi (or something else) to edit /etc/fstab to include the following line:
Code:
10.42.0.1:/home/myuserhomedir /home/myuserhomedir/remhome nfs noauto,rw,user,exec 0 1
Replace 10.42.0.1 with your server's IP address. You can optionally create an entry in /etc/hosts or set up a local nameserver so you can replace the IP address with a user friendly computer name.

This entry sets up an nfs mount, which you can manually mount or umount using the GUI. You can also set it up to automatically mount, but this may not necessarily work exactly when you want it to.

- - - - - -

Here's the sshfs method

- - - sshfs share - - -

On server, install ssh server if not already installed. That is all!
Code:
sudo apt-get install openssh-server
On client, test connection by trying to log into your server:
Code:
ssh 10.42.0.1
Replace 10.42.0.1 with the IP address of your server.

On client, install sshfs, if necessary, with this:
Code:
sudo apt-get install sshfs
Create the remote share folder with:
Code:
mkdir ~/remhome
Now, you can mount the remote share with:
Code:
sshfs 10.42.0.1: ~/remhome
And you can umount it with:
Code:
fusermount -u ~/remhome
You can optionally set up icons to run these commands. If you want to eliminate the password step, you can set up password-less key based authentication (look this up on the Internet to see how).

Personally, I prefer to mount the remote share in the same local folder as the remote, but this doesn't really work out for the home directory. So, for example, I might create the same folder in both the server and client, so the client mount location is identical to the remote location. This is convenient for making symbolic links work the same on the server and client.
 
2 members found this post helpful.
Old 07-17-2017, 01:50 PM   #3
mikedelo
Member
 
Registered: Mar 2004
Location: Staten Island, NY
Distribution: Fedora
Posts: 42

Original Poster
Rep: Reputation: 0
Wow! Thanks @IsaacKuo!!

Does anything change if I am working with an encrypted home folder?

Looks a little intimidating. Is it?
 
Old 07-17-2017, 02:13 PM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 9 Stretch
Posts: 1,922
Blog Entries: 7

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by mikedelo View Post
Wow! Thanks @IsaacKuo!!

Does anything change if I am working with an encrypted home folder?

Looks a little intimidating. Is it?
Do you know what method of encrypted home folder is being used? If it's something which only decrypts the contents when you're logged in, then it may not be practical to use nfs (assuming you are not always logged in on the desktop server). But sshfs method should be fine. The ssh session will log you in, and you'll stay logged in until you fusermount.

If you're logged in on the desktop server all the time, though, then there really should be no difference.

In any case, if you don't really need all of the contents of your desktop's home folder to be accessible, then I really do recommend you create a specific new folder to share. I think it will make your life less confusing since the full paths will remain consistent between the desktop and laptop.

Basically, do the following on the server (the desktop):
Code:
mkdir ~/theshare
sudo apt-get install openssh-server
On the client (the laptop):
Code:
mkdir ~/theshare
sudo apt-get install sshfs
sshfs 10.42.0.1: ~/theshare
fusermount -u ~/theshare
There's really not much going on here. The "sshfs" command is what you use to mount theshare. The "fusermount" command is what you use to umount theshare.
 
1 members found this post helpful.
Old 07-19-2017, 07:51 AM   #5
sixerjman
Member
 
Registered: Sep 2004
Distribution: Debian Testing / Unstable
Posts: 171
Blog Entries: 1

Rep: Reputation: 30
I just did the sshfs thing, it rocks. Thank you, Isaac!
 
Old 07-22-2017, 07:04 PM   #6
Norseman01
Member
 
Registered: Nov 2012
Posts: 85

Rep: Reputation: Disabled
nfs drive

Quote:
Originally Posted by mikedelo View Post
Hello!

I am hoping you can help guide me in the right direction. I have a desktop and a laptop, both running Ubuntu Mate on the same WiFi network at home. I would like to create a network drive on my laptop that connects to my home directory on my desktop - only when I am at home. How can I accomplish this?

Thank you so much!
=====================================
If i have interpreted the above correctly the whole thing is to run when you are at home and not run when you are not.

FIRST:
Install and Start your nfs at both ends.

net-on
#!/bin/bash
#
#/etc/rc.d/rc.inet1 restart #brings up all interfaces
/etc/rc.d/rc.inet1 wlan0_restart #brings up wireless only
ping -c 3 192.168.200.100
# end of file

net-off
> #!/bin/bash
> #
> /etc/rc.d/rc.inet1 stop #shuts down all interfaces
> #/etc/rc.d/rc.inet1 wlan0_stop #shuts down wireless only
> # end of file

If you still have problem this works for me on Slackware 13.0.

#!/bin/bash
# ForceOn.scr
# Force Wireless On after physical OFF switch is turned back ON.
# SLT
# April 2014
#
echo "Resetting wireless"
# below here - sequence counts
modprobe -r ath9k
modprobe -r mac80211
modprobe -r cfg80211
modprobe cfg80211
modprobe mac80211
modprobe ath9k
/etc/rc.d/rc.inet1 wlan0_start
echo "Give housekeeping a moment"
sleep 2
echo "Now Checking Connection"
ping -c 3 192.168.200.100
#echo "-------If no returns, first try manually pinging. Sometimes"
#echo "------- there is a delay. Still no luck? Run net-on"
#echo "------- still no luck? rerun FWO.scr."
#echo "-------The radio is ON? Right?"
echo''
# end of file
#

ALL THE ABOVE ARE DESIGNED FOR IN-HOUSE ONLY.
Allows you to activate/deactivate inet for the machine you are sitting at.
Nothing leaves the building.
Don't leave the doors and windows open.


Norseman01
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
UNetBootin isn't creating bootable flash drive from file on hard drive. glenellynboy Linux - Newbie 44 09-30-2011 05:28 PM
Creating a Linux Boot disk that would share the drive for backup via network to other k_graham Linux - Networking 7 08-27-2011 11:12 AM
[SOLVED] Creating simultaneous network connections to a VPN and local area network. Reactor89 Linux - Networking 2 06-03-2010 12:52 AM
Creating/restoring drive image on USB drive OneSeventeen Linux - Newbie 9 07-06-2005 05:08 AM
Creating a Drive image Earl_UK Linux - Newbie 1 02-16-2005 08:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:30 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration