TL;DR - I recommend learning to just edit the smb.conf file; it's not that hard. But if you don't care and want to try anyway, the steps below might help. If you are really lazy and want to just try running my linux-mint script - I STRONGLY RECOMMEND MAKING A BACKUP FIRST (e.g. with timeshift or whatever full-system backup you use). And to be clear: I do NOT recommend just blindy running scripts off the web. I recommend using my script as a reference but I know there are folks who aren't going to listen; I usually only test my script against Mint so especially newer versions of Ubuntu might have issues that I haven't run into yet. If you find one, I don't mind you submitting an issue on my github with "system-config-samba broken on ubuntu xx.xx" etc; I might look if I have time but it's also not a priority for me. As of May 24, 2021 these steps were verified against Ubuntu 21.04 in a VM and also worked fine on LM-20 (Ubuntu 20.04 base). Also note that if you just download the script and try to run it, it will give you an error as it has some dependencies (see the README file in the script folder for instructions).
2021-May-24 Update: I had a report over on my github that some of the original links I had posted in the wget statements had stopped working. My scripts as well as this post have been updated to use new links (thanks to the note here by user N0rbert). Installing manually has been tested in Virtualbox running Ubuntu 21.04 and I was able to install system-config-samba and get it up and running. See the linked github issue page for more details. I don't recommend continuing to use system-config-samba bc A) I see python2 as a security issue since it is no longer receiving updates, B) it is outdated and never designed to warn you if you have insecure settings, and C) smb.conf is very well-documented and fairly easy to learn. But I understand that some folks might have their reasons and I'm not here to be a naysayer; so consider yourself warned :-)
For anyone looking to get system-config-samba running under Ubuntu 19/Ubuntu 20/etc, there are 4 things you need to need to do to make it work like other normal programs.
Also be forewarned that even if you get it working, it could potentially conflict with some of the newer stuff (samba3/samba4/etc). I have not seen this personally, but I only keep it around to help out some users that want to be able to edit share points and aren't too savvy with text files and it has worked fine for me to fill this use-case.
1. It's no longer in the central repos. This can be solved by downloading the appropriate legacy deb files and manually installing. AGAIN, I STRONGLY RECOMMEND MAKING A TIMESHIFT BACKUP **BEFORE** YOU APPLY THESE CHANGES
# If on Ubuntu 20.10+, it sounds like you will need some additional
# depends for libcairo2 which was apparently removed in Ubuntu 20.10
# credit here goes to user N0bert for figuring this out on fslint post
# Needed for all versions starting from Ubuntu 19.10
# once all deb files are downloaded, to install running the following
# Note I got a couple warnings about:
# 'Failed to preset unit' and
# 'N: Download is performed unsandboxed as root as file'
# I just ignored these; they didn't matter for getting SCS running.
# And if you care about security, why would you install python2 ?!
sudo apt-get install -y ./*.deb
# if it worked, you should be able to find it somewhere on $PATH
2. After install, the libuser.conf bug will prevent it from launching. This can be solved by simply running
sudo touch /etc/libuser.conf
3. The app requires root privileges (makes sense since it edits /etc/samba/smb.conf). The *.desktop shortcut is still using the old gksu command which was removed back in Ubuntu 18. We'll fix the command here since editing a shortcut is quick and easy, but be aware that the shortcut will still be broken until after you've added the Polkit exception in the next step.
The shortcut you need to edit is at
/usr/share/applications/system-config-samba.desktop. We'll be replacing the line
Exec=gksu system-config-samba with
Exec=/usr/bin/pkexec --user root /usr/sbin/system-config-samba
You can do this manually with vim/nano or with sed by running:
sudo sed -Ei 's|^Exec=.*$|Exec=/usr/bin/pkexec --user root /usr/sbin/system-config-samba|g' /usr/share/applications/system-config-samba.desktop
4. Last you'll need to make a polkit exception so that the shortcut will work because, as mentioned earlier, this program works with a priveleged file (/etc/samba/smb.conf) and the old gksu method has long since been deprecated in favor of polkit. Adding the exception allows you to run the program from your menus and just get a graphical authentication prompt.
If you've never messed with anything polkit-related before, chances are that you won't even have the file (it doesn't exist after a fresh install).
First, to check if you even have any existing polkit exceptions, you can use
cat and just check for the file.
$ cat /usr/share/polkit-1/actions/org.freedesktop.policykit.pkexec.policy
cat: /usr/share/polkit-1/actions/org.freedesktop.policykit.pkexec.policy: No such file or directory
If you got 'No such file or directory' then you can just create a blank file and enter the contents (shown below). Or you can copy the one from my git repo:
wget -q https://raw.githubusercontent.com/zpangwin/linux-setup-scripts/master/mint-20/deprecated-system-config-samba/usr/share/polkit-1/actions/org.freedesktop.policykit.pkexec.policy
sudo mv org.freedesktop.policykit.pkexec.policy /usr/share/polkit-1/actions/org.freedesktop.policykit.pkexec.policy
Whether you copied mine or created a new one, make sure your permissions and ownership are set correctly:
sudo chown root:root /usr/share/polkit-1/actions/org.freedesktop.policykit.pkexec.policy;
sudo chmod 644 /usr/share/polkit-1/actions/org.freedesktop.policykit.pkexec.policy;
If you did have some existing definitions, you'll need to be able to edit XML. Since this won't be the case for most users, you'll be on your own for actually learning it but the next couple sentences should get most people by. Start with making a backup using
sudo cp -a /usr/share/polkit-1/actions/org.freedesktop.policykit.pkexec.policy /usr/share/polkit-1/actions/org.freedesktop.policykit.pkexec.policy.bak. Then you'll need to manually edit the file as root so that you can avoid overwritting your existing polkit definitions. If you don't know how to do that, that should be a clue that installing a deprecated package was not a wise decision (but restoring from timeshift is easy... you did make that backup right?). Anyway, you'll want to copy part of my sample text below - but just from
</action> (including the opening/closing action tags). Then paste that into your file between the last existing definiton's
</action> and before the
SAMPLE POLKIT FILE (org.freedesktop.policykit.pkexec.policy):
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<description>Run Samba Config</description>
<message>Authentication is required to run Samba Config</message>