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

    Looking for an effective way to quickly access SMB shares from Fedora

    IT Discussion
    smb fedora
    8
    37
    2.2k
    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.
    • IRJI
      IRJ
      last edited by IRJ

      I am looking for a way to speed up connecting to common SMB shares on Fedora. My current process is definitely not the most efficient way.

      I keep a text file of my really common SMB shares that looks something like this

      smb://192.168.1.1/share
      smb://192.168.1.2/share
      smb://192.168.1.3/share
      smb://192.168.1.4/share
      

      I open file manager, add a location, and paste this into there. It then prompts me for credentials. After that process, the share is connected until I reboot.

      What I want:

      To automatically add 3 or 4 shares from terminal with one command that prompts me for password and then connects all my common shares.

      travisdh1T Emad RE 2 Replies Last reply Reply Quote 0
      • DashrenderD
        Dashrender
        last edited by

        I don't know schit about using Linux - but isn't there a way to automount partitions? wouldn't you use that same mechanism to mount SMB shares at boot? or a logon script for your user account that does it when you log in?

        IRJI 1 Reply Last reply Reply Quote 0
        • travisdh1T
          travisdh1 @IRJ
          last edited by

          @IRJ You are not mounting them within /etc/fstab? I assume you don't want the password stored anywhere.

          Bash script it, something like:

          #!/bin/bash
          read -p "Enter your username: " user
          read -p "Enter your password: " pass
          mount -t smb -o username=$user,password=$pass //192.168.1.1/share1 /mount/point
          
          IRJI 1 Reply Last reply Reply Quote 3
          • IRJI
            IRJ @Dashrender
            last edited by

            @Dashrender said in Looking for an effective way to quickly access SMB shares from Fedora:

            I don't know schit about using Linux - but isn't there a way to automount partitions? wouldn't you use that same mechanism to mount SMB shares at boot? or a logon script for your user account that does it when you log in?

            I dont want automount because I jump networks alot. One thing I have noticed is that if you dont properly disconnect shares, it can cause longer load times in File Manger. I also dont use SMB shares but a few times throughout the day. I would rather just bring them up on demand.

            DustinB3403D 1 Reply Last reply Reply Quote 0
            • IRJI
              IRJ @travisdh1
              last edited by

              @travisdh1 said in Looking for an effective way to quickly access SMB shares from Fedora:

              @IRJ You are not mounting them within /etc/fstab? I assume you don't want the password stored anywhere.

              Bash script it, something like:

              #!/bin/bash
              read -p "Enter your username: " user
              read -p "Enter your password: " pass
              mount -t smb -o username=$user,password=$pass //192.168.1.1/share1 /mount/point
              

              Yeah this is pretty much what I am looking for. However my laptop is not domain joined. I would like to save username and domain. Then just have it prompt for a password.

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

                @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                @Dashrender said in Looking for an effective way to quickly access SMB shares from Fedora:

                I don't know schit about using Linux - but isn't there a way to automount partitions? wouldn't you use that same mechanism to mount SMB shares at boot? or a logon script for your user account that does it when you log in?

                I dont want automount because I jump networks alot. One thing I have noticed is that if you dont properly disconnect shares, it can cause longer load times in File Manger. I also dont use SMB shares but a few times throughout the day. I would rather just bring them up on demand.

                So why not script the shares for any given site, and when you're on-site and need those shares you simply run the bash script.

                @travisdh1 posted something that would work well for that.

                IRJI 1 Reply Last reply Reply Quote 1
                • IRJI
                  IRJ @DustinB3403
                  last edited by

                  @DustinB3403 said in Looking for an effective way to quickly access SMB shares from Fedora:

                  @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                  @Dashrender said in Looking for an effective way to quickly access SMB shares from Fedora:

                  I don't know schit about using Linux - but isn't there a way to automount partitions? wouldn't you use that same mechanism to mount SMB shares at boot? or a logon script for your user account that does it when you log in?

                  I dont want automount because I jump networks alot. One thing I have noticed is that if you dont properly disconnect shares, it can cause longer load times in File Manger. I also dont use SMB shares but a few times throughout the day. I would rather just bring them up on demand.

                  So why not script the shares for any given site, and when you're on-site and need those shares you simply run the bash script.

                  @travisdh1 posted something that would work well for that.

                  Yep. I like his idea. I was just replying in order 🙂

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

                    @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                    @DustinB3403 said in Looking for an effective way to quickly access SMB shares from Fedora:

                    @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                    @Dashrender said in Looking for an effective way to quickly access SMB shares from Fedora:

                    I don't know schit about using Linux - but isn't there a way to automount partitions? wouldn't you use that same mechanism to mount SMB shares at boot? or a logon script for your user account that does it when you log in?

                    I dont want automount because I jump networks alot. One thing I have noticed is that if you dont properly disconnect shares, it can cause longer load times in File Manger. I also dont use SMB shares but a few times throughout the day. I would rather just bring them up on demand.

                    So why not script the shares for any given site, and when you're on-site and need those shares you simply run the bash script.

                    @travisdh1 posted something that would work well for that.

                    Yep. I like his idea. I was just replying in order 🙂

                    So was I, you just rapid fire responded. 🙂

                    1 Reply Last reply Reply Quote 0
                    • JaredBuschJ
                      JaredBusch
                      last edited by

                      Put your username and password in a text file in your hidden /home/user/.config folder.
                      Create this file /home/user/.config/smb_creds
                      With this content

                      username=SMBUser
                      password=SMBPassword
                      

                      Create a folder to mount the share to

                      mkdir /home/user/mountfolder
                      

                      Put this line in /etc/fstab

                      //192.168.1.1/share    /home/user/mountfolder    cifs    defaults,credentials=/home/user/.config/smb_creds,users,auto,uid=1000,gid=1000    0    0
                      

                      Reboot.

                      had to google the fstab bit couldn't remember the syntax, so might be off, but should be close.

                      IRJI DustinB3403D 2 Replies Last reply Reply Quote 3
                      • IRJI
                        IRJ @JaredBusch
                        last edited by

                        @JaredBusch said in Looking for an effective way to quickly access SMB shares from Fedora:

                        Put your username and password in a text file in your hidden /home/user/.config folder.
                        Create this file /home/user/.config/smb_creds
                        With this content

                        username=SMBUser
                        password=SMBPassword
                        

                        Can I store domain there as well?

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

                          @JaredBusch Isn't that automounting?

                          JaredBuschJ IRJI 2 Replies Last reply Reply Quote 0
                          • DustinB3403D
                            DustinB3403 @IRJ
                            last edited by

                            @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                            @JaredBusch said in Looking for an effective way to quickly access SMB shares from Fedora:

                            Put your username and password in a text file in your hidden /home/user/.config folder.
                            Create this file /home/user/.config/smb_creds
                            With this content

                            username=SMBUser
                            password=SMBPassword
                            

                            Can I store domain there as well?

                            You'd just enter the username as domain@user iirc

                            IRJI DashrenderD 2 Replies Last reply Reply Quote 3
                            • JaredBuschJ
                              JaredBusch @DustinB3403
                              last edited by

                              @DustinB3403 said in Looking for an effective way to quickly access SMB shares from Fedora:

                              @JaredBusch Isn't that automounting?

                              Yes, but I was typign all that when from before @travisdh1's reply.

                              1 Reply Last reply Reply Quote 1
                              • IRJI
                                IRJ @DustinB3403
                                last edited by

                                @DustinB3403 said in Looking for an effective way to quickly access SMB shares from Fedora:

                                @JaredBusch Isn't that automounting?

                                I really like the idea of cred file. That would make things easy.

                                Instead of autoconfig, I would like a script that I could use for connecting that breaks connection at reboot

                                DustinB3403D JaredBuschJ 2 Replies Last reply Reply Quote 0
                                • IRJI
                                  IRJ @DustinB3403
                                  last edited by

                                  @DustinB3403 said in Looking for an effective way to quickly access SMB shares from Fedora:

                                  @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                                  @JaredBusch said in Looking for an effective way to quickly access SMB shares from Fedora:

                                  Put your username and password in a text file in your hidden /home/user/.config folder.
                                  Create this file /home/user/.config/smb_creds
                                  With this content

                                  username=SMBUser
                                  password=SMBPassword
                                  

                                  Can I store domain there as well?

                                  You'd just enter the username as domain@user iirc

                                  ok. That is easy enough.

                                  travisdh1T 1 Reply Last reply Reply Quote 0
                                  • travisdh1T
                                    travisdh1 @IRJ
                                    last edited by travisdh1

                                    @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                                    @DustinB3403 said in Looking for an effective way to quickly access SMB shares from Fedora:

                                    @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                                    @JaredBusch said in Looking for an effective way to quickly access SMB shares from Fedora:

                                    Put your username and password in a text file in your hidden /home/user/.config folder.
                                    Create this file /home/user/.config/smb_creds
                                    With this content

                                    username=SMBUser
                                    password=SMBPassword
                                    

                                    Can I store domain there as well?

                                    You'd just enter the username as domain@user iirc

                                    ok. That is easy enough.

                                    I'd make another script to unmount the shares when your done with them as well.

                                    #!/bin/bash
                                    umount /mount/point
                                    
                                    DustinB3403D 1 Reply Last reply Reply Quote 3
                                    • DustinB3403D
                                      DustinB3403 @IRJ
                                      last edited by

                                      @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                                      @DustinB3403 said in Looking for an effective way to quickly access SMB shares from Fedora:

                                      @JaredBusch Isn't that automounting?

                                      I really like the idea of cred file. That would make things easy.

                                      Instead of autoconfig, I would like a script that I could use for connecting that breaks connection at reboot

                                      You still should dismount the share (in a normal circumstance), but at least the approach @travisdh1 posted won't automount.

                                      1 Reply Last reply Reply Quote 0
                                      • JaredBuschJ
                                        JaredBusch @IRJ
                                        last edited by

                                        @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                                        @DustinB3403 said in Looking for an effective way to quickly access SMB shares from Fedora:

                                        @JaredBusch Isn't that automounting?

                                        I really like the idea of cred file. That would make things easy.

                                        Instead of autoconfig, I would like a script that I could use for connecting that breaks connection at reboot

                                        Combine the two suggestions.

                                        Don't use fstab, use the mount. But don't prompt for the user/pass, read it from a config file.

                                        1 Reply Last reply Reply Quote 3
                                        • DustinB3403D
                                          DustinB3403 @travisdh1
                                          last edited by

                                          @travisdh1 said in Looking for an effective way to quickly access SMB shares from Fedora:

                                          @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                                          @DustinB3403 said in Looking for an effective way to quickly access SMB shares from Fedora:

                                          @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                                          @JaredBusch said in Looking for an effective way to quickly access SMB shares from Fedora:

                                          Put your username and password in a text file in your hidden /home/user/.config folder.
                                          Create this file /home/user/.config/smb_creds
                                          With this content

                                          username=SMBUser
                                          password=SMBPassword
                                          

                                          Can I store domain there as well?

                                          You'd just enter the username as domain@user iirc

                                          ok. That is easy enough.

                                          I'd make another script to unmount the shares when your done with them as well.

                                          #!/bin/bash
                                          unmount /mount/point
                                          

                                          Might make that one big general dismount for all of the shares you might even use. Rather than a script per SMB server.

                                          travisdh1T 1 Reply Last reply Reply Quote 0
                                          • DashrenderD
                                            Dashrender @DustinB3403
                                            last edited by

                                            @DustinB3403 said in Looking for an effective way to quickly access SMB shares from Fedora:

                                            @IRJ said in Looking for an effective way to quickly access SMB shares from Fedora:

                                            @JaredBusch said in Looking for an effective way to quickly access SMB shares from Fedora:

                                            Put your username and password in a text file in your hidden /home/user/.config folder.
                                            Create this file /home/user/.config/smb_creds
                                            With this content

                                            username=SMBUser
                                            password=SMBPassword
                                            

                                            Can I store domain there as well?

                                            You'd just enter the username as domain@user iirc

                                            or domain\username depending on what type of domain you're connecting to.

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