Auto-mount persistent SMB shares

Howdy, folks.
Sorry to say so far no posted answers I've seen so far are working for me.

I have an SMB share elsewhere on my LAN and I can mount it in Files with
Other locations > Server address > SMB://[machine_name].local/[share_name]/ > Connect
UID + password are stored making it easy to mount each time I restart Zorin 16 pro.
I'd like said share to auto-mount upon each restart.
In terminal autofs is not an available command so answers that suggest that do not work for me. I don't (think I) have Nautilus, so those posts do not help either. I saw a mention of something called GIG0L0; would a 3rd party product such as this help?

I am NOT Ubuntu fluent as I come (as do so many of us) from a μ$ (Windows) world.

Any help is greatly appreciated. Thanks, all.

A quick & dirty way: sudo apt install smbmap

The proper way: Set up the drive in /etc/fstab.

TLDR:
sudo apt install cifs-utils

In /etc/fstab:

//SERVER/share /mnt/samba cifs username=user,password=passwd 0 0
... where:
“share” = the name of the network share
“SERVER” = server’s name or IP address
”user” = your SAMBA username
”passwd” = your SAMBA password

I had posted a potential solution here, using Public folders on both machines:

Also check firewall settings in GUFW:

So far none of the methods here work for me (yet!).
Three issues I'll try to describe follow.
(and, yes, I am changing paths, names, and passwords)

#1 ------ smbmap --------

I tried all the variations on commands from the smbmap instructions but none worked.
Examples:

rich:~$ python smbmap.py -u userid -p password -d workgroup -H 192.168.211.59 -s sharename
Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3

rich:~$ smbmap -u userid -p password -d workgroup -H 192.168.211.59 -s sharename
[+] Finding open SMB ports....
[!] Authentication error on 192.168.211.59

#2 ------ itslinuxfoss --------

I tried the instructions from itslinuxfoss, and I can I can install the utility using:
sudo apt install cifs-utils -y

But I still have to edit /etc/fstab (add the line)
//192.168.43.20/share /media/share cifs vers=3.0,credentials=/.SMBcredentials
or
//SERVER/share /mnt/samba cifs username=user,password=passwd 0 0
but in the example above with the IP address

A) fstab is read only, cannot edit it.
B) BTW, I do not know what credentials=/.SMBcredentials means or how to use it.

#3 ------ Firewall (gufw) --------
I do not understand how to know what port numbers to enter or where to add them.

sudo apt install nautilus-admin
nautilus -q

Navigate to Other Locations > Computer > etc

Find the file fstab, right-click it, select "Edit As Administrator", enter your password (you might have to enter your password twice... it's a bug).

-- and / or --

Navigate to the Home directory, open the .bashrc file, put this directly under this code:

This code you'll have in there already:

Summary
# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# NOTE: ALL ALIASES ARE SET UP IN ~/.bash_aliases file.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

Directly below the code above, put this:

# Edit files by using sudoedit /{path}
export SUDO_EDITOR='/usr/bin/gedit -w'

Save the file, reboot, then you can open Terminal and issue the command:
sudoedit /etc/fstab

I use gigolo for this function.
I have 7 smb shares on my LAN and it auto-mounts them at boot time.
I have other smb shares that I only use occasionally and I can save them in gigolo and just manually connect them when needed.
I have gigolo set to run on startup.

1 Like

The /.SMBcredentials is a file you create in your home directory. When you reference it, you must include a ~ in front of the /.... the path will be ~/.SMBcredentials.

The format of the file should be in the link provided. Most likely:

user=<username>
password=<password>

As for the python command, try running:

python3 smbmap.py -u userid -p password -d workgroup -H 192.168.211.59 -s sharename

python refers to python2, which was removed from Ubuntu distros late last year. The alias python is reserved for python2. python3 is how you will access and run python scripts unless you download a python 2 version and script.

Just found this:

nautilus-share/focal 0.7.3-2ubuntu3 amd64
Nautilus extension to share folder using Samba

sudo apt install nautilus-share

So I installed nautilus-share, not hopw do I access that to set my SMB to auto-mount?
Thanks.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.