ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    [RESOLVED] Mounting an SMB network share on Ubuntu during SSH logon process

    IT Discussion
    6
    15
    1.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sn
      last edited by sn

      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?

      1 Reply Last reply Reply Quote 0
      • M
        manxam
        last edited by

        I've never had to do this before but could think of handling it one of two ways:

        1. placing a mount command in their bashrc/profile scipt
        2. use autofs and a secrets file per user such as this

        I'm sure others will have much better solutions to mine though 🙂

        1 Reply Last reply Reply Quote 0
        • DustinB3403D
          DustinB3403
          last edited by

          Why not add entries to fstab?

          1 Reply Last reply Reply Quote 0
          • matteo nunziatiM
            matteo nunziati
            last edited by matteo nunziati

            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

            1 Reply Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller
              last edited by

              FUSE lets you mount in the user space.

              black3dynamiteB 1 Reply Last reply Reply Quote 0
              • black3dynamiteB
                black3dynamite @scottalanmiller
                last edited by

                @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?

                matteo nunziatiM 1 Reply Last reply Reply Quote 0
                • matteo nunziatiM
                  matteo nunziati @black3dynamite
                  last edited by

                  @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

                  black3dynamiteB 1 Reply Last reply Reply Quote 0
                  • black3dynamiteB
                    black3dynamite @matteo nunziati
                    last edited by black3dynamite

                    @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.

                    matteo nunziatiM 1 Reply Last reply Reply Quote 0
                    • matteo nunziatiM
                      matteo nunziati @black3dynamite
                      last edited by

                      @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?

                      black3dynamiteB 1 Reply Last reply Reply Quote 0
                      • black3dynamiteB
                        black3dynamite @matteo nunziati
                        last edited by black3dynamite

                        @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.

                        matteo nunziatiM 1 Reply Last reply Reply Quote 0
                        • matteo nunziatiM
                          matteo nunziati @black3dynamite
                          last edited by matteo nunziati

                          @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...

                          black3dynamiteB 1 Reply Last reply Reply Quote 0
                          • black3dynamiteB
                            black3dynamite @matteo nunziati
                            last edited by

                            @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 or sftp://1.2.3.4
                            After that the remote system shows up in /run/media/username

                            matteo nunziatiM 1 Reply Last reply Reply Quote 0
                            • matteo nunziatiM
                              matteo nunziati @black3dynamite
                              last edited by

                              @black3dynamite so it seems sftp! got it! yes if you mount temporarily as a user you get your stuff in /run/media/$usrname.

                              1 Reply Last reply Reply Quote 0
                              • S
                                sn
                                last edited by

                                Thanks everyone, let me try your suggestions and come back to this thread again soon

                                1 Reply Last reply Reply Quote 0
                                • S
                                  sn
                                  last edited by

                                  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.

                                  1 Reply Last reply Reply Quote 0
                                  • 1 / 1
                                  • First post
                                    Last post