LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 12-11-2013, 04:36 AM   #1
lpwevers
Member
 
Registered: Apr 2005
Location: The Netherlands
Distribution: SuSE, CentOS
Posts: 109

Rep: Reputation: 20
Automount user filesystem on console login only


Hello experts,

At my work I'm faced with a challenge. It has been decided that we're moving to a Linux desktop environment. Basically it's a cluster of RedHat Enterprise Virtualisation (RHEV) servers running VDI's for all our users. They can then connect to the console of a running VDI and start working.

Now all that is working fine, but there is still one challenge left. I'm asked to configure the systems that a user specific directory is mounted when the user logs in to the console. (So, that's logs in to Gnome in practice). The problem is that if, for example, I use ssh to connect to the machine, the directory should not be mounted. Hence I can't use .profile or automount to perform the mount.

Then I tried running a script on gnome login to perform the mount, using udisks, but since the filesystem to mount is an NFS share, udisks is not of much help.

I could of course add all these user specific entries to fstab and make them user mountable, but since we have about 1000 users (with several 10s changing every week) that's not really a workable solution.

Any suggestions on how I can get this to work?
 
Old 12-11-2013, 09:28 AM   #2
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,929

Rep: Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306
automount can handle user's home dirs.
probably this link helps a bit: http://rivald.blogspot.hu/2009/11/au...er-nfs-in.html
 
Old 12-12-2013, 01:07 AM   #3
lpwevers
Member
 
Registered: Apr 2005
Location: The Netherlands
Distribution: SuSE, CentOS
Posts: 109

Original Poster
Rep: Reputation: 20
Hi, thanks for the reply

Quote:
Originally Posted by pan64 View Post
automount can handle user's home dirs.
probably this link helps a bit: http://rivald.blogspot.hu/2009/11/au...er-nfs-in.html
Unfortunately this is not what I'm looking for. As mentioned, I only want to mount this directory if the user logs in from the console. If I use automount, it will also be mounted if a user uses something like ssh to login to the system.

Maybe it was not clear from my first post, but it's not the home directory I need to mount. This is some extra space we want to give to our users on so called "cheap" storage. It will always be mounted using the exact same location, /scratch; no subdirectories like /scratch/<userid>. That's why I only want it at console login. Ohterwise I don't know what will happen, but I assume in that case what's mounted in /scratch will be of the last user logged into the system.
 
Old 12-12-2013, 01:11 AM   #4
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,929

Rep: Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306
automount can handle that kind of mounts also, it will automatically mount drive if someone wants to access it. (if I understand it well)
 
Old 03-03-2014, 06:58 AM   #5
lpwevers
Member
 
Registered: Apr 2005
Location: The Netherlands
Distribution: SuSE, CentOS
Posts: 109

Original Poster
Rep: Reputation: 20
In the end we managed to get this working by using pam. Adding something like this to /etc/security/console.handlers does the trick:
Code:
console consoledevs tty[0-9][0-9]* vc/[0-9][0-9]* :[0-9]+\.[0-9]+ :[0-9]+
/bin/mountscript.sh lock logfail wait tty user
/bin/umountscript.sh unlock logfail wait tty user
[/code]
And in the (u)mount script you can then use $1, as that holds the userID of the logged in user.
 
  


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
unable to login any user through the console but users can login in GUI p kumar Linux - Server 1 04-19-2012 06:09 AM
root user must not be allowed to directly login to service console dimpleboy Linux - Newbie 4 05-12-2011 09:08 PM
auto login as root (or other user) in console mode Peter_Peck Linux - General 4 05-01-2009 02:05 AM
Can not login as any user in TTY console suhas! Linux - Newbie 12 07-05-2008 05:14 AM
Problems with console login on newly created root filesystem (for PXEboot) holandes777 Linux - General 1 08-05-2004 05:11 PM


All times are GMT -5. The time now is 10:28 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration