LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-19-2018, 11:45 AM   #1
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, EndeavourOS, OpenSUSE, KDE Neon
Posts: 4,003
Blog Entries: 26

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
Any way to pass variables in /etc/fstab?


So I'm trying to set up fstab so that users have access to their homedrive. All homedrives are on the same server, but of course need different credentials, so it's a 2 part question:

1. Is there a way to write the line in fstab so that the remote directory to be mounted is pulled from their username? IE - //remote/$user. I know this specifically doesn't work, but I'm wondering if there's anything that does the same in fstab?

2. Credentials file. Is there anything I can use for specifying the credentials file? IE - credentials=$home/.credentials so that each user passes the correct username/password? I know $home doesn't work, but is there anything I can do that would replicate?

Thanks!
Most of my users are clueless when it comes to linux, so I want as much of a hands-off click and go solution, and some of them share a single linux laptop for their group, so I need it set up to be able to work with multiple users on the same machine. I have it set up to work with a single user just fine.
 
Old 04-19-2018, 11:54 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Are these home directories in an NFS share from the server? if so you might want to use automounter to accomplish what you want.

One write up for how to do that on CentOS (which would be the same on RHEL) is at:
http://www.learnitguide.net/2016/01/...nfs-linux.html
 
Old 04-19-2018, 11:55 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,292
Blog Entries: 3

Rep: Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718
Which protocol are you using to mount the remote directories or file systems? NFS, OpenAFS, SMB, sshfs (SFTP), Coda, etc?

Which distro is doing the mounting?
 
Old 04-19-2018, 12:00 PM   #4
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, EndeavourOS, OpenSUSE, KDE Neon
Posts: 4,003

Original Poster
Blog Entries: 26

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
Quote:
Originally Posted by Turbocapitalist View Post
Which protocol are you using to mount the remote directories or file systems? NFS, OpenAFS, SMB, sshfs (SFTP), Coda, etc?

Which distro is doing the mounting?
CIFS (SMB)

distro will depend, most users will probably use Ubuntu, but at least some will use Fedora or Debian.

Quote:
Originally Posted by MensaWater View Post
Are these home directories in an NFS share from the server? if so you might want to use automounter to accomplish what you want.

One write up for how to do that on CentOS (which would be the same on RHEL) is at:
http://www.learnitguide.net/2016/01/...nfs-linux.html
Hmmm, this is basically exactly what I was looking for...just need to see if I can figure it out. Surprising I'd NEVER heard of this. Too bad that tutorial lacks anything that actually explains how to use it. Will have to do some googling.

Last edited by Timothy Miller; 04-19-2018 at 12:04 PM.
 
Old 04-19-2018, 12:40 PM   #5
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, EndeavourOS, OpenSUSE, KDE Neon
Posts: 4,003

Original Poster
Blog Entries: 26

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
Yes!! Autofs works perfectly!! Thanks!!

PITA to get working on Arch...was easy on Debian, Ubuntu and Fedora.

In the end, I had it mounting to say /mnt/company/x and with Debian, Ubuntu and Fedora, it didn't mind if the /mnt/company folders already existed. With Arch, if the company folder existed, it would fail to mount. Just a small bit of troubleshooting if anyone else runs into this in the future.

Last edited by Timothy Miller; 04-19-2018 at 04:55 PM.
 
1 members found this post helpful.
Old 04-19-2018, 11:55 PM   #6
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, EndeavourOS, OpenSUSE, KDE Neon
Posts: 4,003

Original Poster
Blog Entries: 26

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
So, just some weirdness.

On my desktop and 1 laptop (both Debian), this works perfectly with vers=3.0 in the mount options.

On another laptop, identical Debian installation, this WILL NOT work with vers=3.0, but does work with vers=2.0 in the mount options. However, if I pass the mount command directly, vers=3.0 does work!!

Odd.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Any way to pass variables in /etc/fstab? Timothy Miller Linux - General 1 04-19-2018 11:56 AM
[SOLVED] hiphop - how to pass CMAKE variables? eantoranz Programming 1 07-12-2012 01:50 PM
[SOLVED] I need to pass environment variables to emacs CollieJim Programming 1 06-04-2012 07:45 AM
How do I pass variables? Karas Linux - Newbie 2 11-23-2009 11:55 AM
pass variables through hyperlink in php ALInux Programming 2 12-23-2005 01:27 PM

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

All times are GMT -5. The time now is 01:43 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
Open Source Consulting | Domain Registration