[RESOLVED] Mounting an SMB network share on Ubuntu during SSH logon process
-
I have an Ubuntu 16.04 server and a Synology NAS, both joined to my Windows 2008 R2 domain.
Ubuntu machine is used by multiple, say, 10 domain users via SSH.
Synology NAS has got a file share with separate level of SMB access permissions for each of these domain users.
I have a requirement to automatically mount this file share on the Ubuntu machine whenever my domain users login to it using SSH.
(I would say, this requirement is something like the logon script in Windows which would allow a user to map a network drive to their computer using their login credentials during the logon process so that the user would able to see on those files and folders in the network drive which he/she has access to)
How do I get this working?
-
I've never had to do this before but could think of handling it one of two ways:
- placing a mount command in their bashrc/profile scipt
- use autofs and a secrets file per user such as this
I'm sure others will have much better solutions to mine though
-
Why not add entries to fstab?
-
Mounting fs requires root privileges afaik. If the user runs bash you could mount using fuse in bashrc. Anyway fstab with proper mount point permissions should fit.
EDIT. Use gvfs
-
FUSE lets you mount in the user space.
-
@scottalanmiller said in Mounting an SMB network share on Ubuntu during SSH logon process:
FUSE lets you mount in the user space.
On Fedora, I notice all my mounted devices is accessible in
/run/media/username/
Is that a common location for mounted devices per user? -
@black3dynamite yes this is common for -say - usb keys and the so. /run/media is the mount point for removeable devices (even CD/DVD). Recently it is classified on a per-user basis, adding an additional level with /run/media/$usrname
-
@matteo-nunziati said in Mounting an SMB network share on Ubuntu during SSH logon process:
@black3dynamite yes this is common for -say - usb keys and the so. /run/media is the mount point for removeable devices (even CD/DVD). Recently it is classified on a per-user basis, adding an additional level with /run/media/$usrname
Looks like /run/media is the mount point for ssh too.
-
@black3dynamite said in Mounting an SMB network share on Ubuntu during SSH logon process:
@matteo-nunziati said in Mounting an SMB network share on Ubuntu during SSH logon process:
@black3dynamite yes this is common for -say - usb keys and the so. /run/media is the mount point for removeable devices (even CD/DVD). Recently it is classified on a per-user basis, adding an additional level with /run/media/$usrname
Looks like /run/media is the mount point for ssh too.
what do you mean? ssh is not a device or an fs. what do you mount with ssh?
-
@matteo-nunziati said in Mounting an SMB network share on Ubuntu during SSH logon process:
@black3dynamite said in Mounting an SMB network share on Ubuntu during SSH logon process:
@matteo-nunziati said in Mounting an SMB network share on Ubuntu during SSH logon process:
@black3dynamite yes this is common for -say - usb keys and the so. /run/media is the mount point for removeable devices (even CD/DVD). Recently it is classified on a per-user basis, adding an additional level with /run/media/$usrname
Looks like /run/media is the mount point for ssh too.
what do you mean? ssh is not a device or an fs. what do you mount with ssh?
Mounting a remote file system via ssh using Nautilus.
-
@black3dynamite said in Mounting an SMB network share on Ubuntu during SSH logon process:
Mounting a remote file system via ssh using Nautilus.
mmm... never done. what's that? sftp? scp? sshfs? uh...
-
@matteo-nunziati said in Mounting an SMB network share on Ubuntu during SSH logon process:
@black3dynamite said in Mounting an SMB network share on Ubuntu during SSH logon process:
Mounting a remote file system via ssh using Nautilus.
mmm... never done. what's that? sftp? scp? sshfs? uh...
In Gnome Nautilus, I go to Connect to Server, I then connect using
ssh://1.2.3.4
orsftp://1.2.3.4
After that the remote system shows up in /run/media/username -
@black3dynamite so it seems sftp! got it! yes if you mount temporarily as a user you get your stuff in /run/media/$usrname.
-
Thanks everyone, let me try your suggestions and come back to this thread again soon
-
It took me a while to revisit this issue though i have managed to address this issue using multiuser SMB mount.
In essence, you would add the mount point to the fstab using the multiuser and ntlmssp options and then you would run
the cifscreds command to authenticate a specific user against the SMB server at the time of login so that that user would be able to see only those sub-folders/files which he/she has access to under the smb mount.