LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-05-2020, 05:08 PM   #1
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 190

Rep: Reputation: 19
Question Mounting remote share via fstab as home directory for a user???


Dear LinuxQuestions.org,

As part of my learning process, I've been thinking about experimenting with using fstab-mounted network shares as home directories for users. For example, let's say I have a user `hsimpson` on a CentOS 8 system. Instead of using local `/home/hsimpson` as that user's home directory, I add this line to my `/etc/fstab` file:

Code:
\\remote\share /home/hsimpson cifs user,uid=123,rw,suid,username=foo,password=bar 0 0
Where `uid=123` is user `hsimpson`'s UID in the local system. (I know I can additionally use a credentials file instead of putting the remote username and password in fstab) Is this all that's needed to make the home directory on a remote share?

If I want to do this, what should I do when first creating the user `hsimpson` with `useradd`? How do I correctly specify this home directory? Any gotchas? Do I set up fstab first, then create the user while specifying the fstab mountpoint as the home directory?

Also, would this incur permissions (or even SELinux?!?!?!) problems for `hsimpson`?

Thank you!
 
Old 04-06-2020, 11:47 AM   #2
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by penyuan View Post
Is this all that's needed to make the home directory on a remote share?
No, because a cifs mounted volume cannot be used as a home dir, because of, among others, lack of support for links (both hard and symbolic) and Unix attributes.
We (at my previous job) did use remote home dirs but the server used a LINUX fs (that did support those) and we used the automounter (with NFS) to mount the home dir only when that user was logged in.
So when user "joe" logged in a directory /home/joe was automounted from the home dir server from the SSC/ICT (Shared Service Center/Information and Communication Technology).
The user itself was validated through ldap (Lightweight Directory Access Protocol) from a set of Windows Active Directory servers.
This made for a highly specific configuration of Linux clients, which took several months to develop.

Last edited by ehartman; 04-06-2020 at 11:49 AM.
 
2 members found this post helpful.
Old 04-06-2020, 02:42 PM   #3
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 190

Original Poster
Rep: Reputation: 19
Thumbs up

Quote:
Originally Posted by ehartman View Post
No, because a cifs mounted volume cannot be used as a home dir, because of, among others, lack of support for links (both hard and symbolic) and Unix attributes.
I see. Great to know, thank you! So a CIFS-mounted volume is unsuitable, but what about others? I know you've cited NFS as one that works, but are there other protocols that can also work for mounting a remote home directory?

Quote:
Originally Posted by ehartman View Post
...we used the automounter (with NFS) to mount the home dir only when that user was logged in.
How did you achieve this? I thought `/etc/fstab` is run only at boot time? How did you trigger mounting a certain network share when a user logs in?
 
Old 04-06-2020, 04:59 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by penyuan View Post
I thought `/etc/fstab` is run only at boot time? How did you trigger mounting a certain network share when a user logs in?
Look up AutoFS.
 
1 members found this post helpful.
  


Reply

Tags
fstab, home directory, remote



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
Redirect an app resource folder from system /usr/share to /home/user/[app]/usr/share minyor Linux - Software 2 04-23-2013 06:44 AM
[SOLVED] mounting a partition in /home/user and changing /etc/fstab gone wrong JZL240I-U Linux - Software 11 06-06-2012 09:42 AM
Cannot mount unencrypted directory to encrypted home directory with fstab? Daravon Ubuntu 35 09-14-2010 03:50 AM
User shown as "already exist" when there is no user directory shown on home directory Sharpeye Linux - Newbie 3 03-18-2009 01:17 AM
Mounting windows share via cifs (fstab entry) - error 13 opening credentials file O(V)eGA_l2el) Linux - Networking 2 12-05-2006 11:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:18 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