2

I'm using Xubuntu 18.04 and while launching Samba I get an error saying "Failed to execute command gksu system-config-samba" please help. I'm a beginner.

12
  • gksu isn't supported in 18.04. It sounds like you are using an old desktop launcher for system-config-samba. Aug 13, 2018 at 14:00
  • Hmm, mine is the same. I tried reinstalling it but it didn't give me a new launcher. I think this is a bug. The launcher needs to be fixed to use pkexec but I'm on a phone now so can't tackle this one. Aug 13, 2018 at 14:07
  • Is there any solution to it? Aug 13, 2018 at 14:13
  • i tried without gksu, it shows a warning "Some lines couldn't be understood while reading the configuration file /etc/samba/smb.conf " Aug 13, 2018 at 14:15
  • A script needs to be made that starts system-config-samba using pkexec instead of gksu, and the desktop file needs ti be copied to ~/.local/share/applications and the exec=command replaced with the new script. But I can't do that on my phone. Aug 13, 2018 at 14:19

2 Answers 2

3

Open a terminal and run this command:

sudo touch /etc/libuser.conf

Then run this command to start the application:

sudo -H system-config-samba

Edit: To have it launch from the menu:

** Create a new file at: /usr/share/polkit-1/actions/com.ubuntu.pkexec.samba.policy

Add this to it:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>

  <action id="com.ubuntu.pkexec.samba">
    <message>Authentication is required to run the Samba Server Settings</message>
        <icon_name>samba</icon_name>
    <defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>auth_admin</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/system-config-samba</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
  </action>

** Edit the launcher at /usr/share/applications/system-config-samba.desktop

Find this line: Exec=gksu system-config-samba

Replace with this line: Exec=pkexec system-config-samba

Note: This seems overkill for something that:

(1) WIll likely be used once or twice in a year.

(2) Will eventually be removed from the repository: https://bugs.launchpad.net/ubuntu/+source/system-config-samba/+bug/1740419

3
  • Now how can I mark solved here? Aug 15, 2018 at 1:05
  • @PranayaAdhikari There should be a check mark underneath the voting buttons that you can click to accept the answer.
    – Thomas Ward
    Aug 15, 2018 at 1:37
  • Since you asked how to mark it solved in my answer did you intend to do so in my answer. If you did you marked the wrong one as solved.
    – Morbius1
    Aug 15, 2018 at 12:06
1

It looks like there is a mistake in system-config-samba.desktop in that it still uses 'gksu' which isn't supported in 18.04.

First let's fix that.

(Edited)

Create a script file where-ever you keep scripts. I keep them in ~/scripts so I called it ~/scripts/samba-pkexec. In this file add the line

Exec=pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY system-config-samba

and exit, saving your work.

Make sure the file has executable permission (either using your file manager or command line).

Using the method of your choice, copy /usr/share/applications/system-config-samba.desktop to ~/.local/share/applications

Then open ~/.local/share/applications/system-config-samba.desktop in the editor of your choice, find the line that looks like this

Exec=gksu system-config-samba

and change it to

Exec=[full path to the script file you created]

Exit, saving your work.

Do whatever you need to do in order to make your desktop pick up the change. (I use LXDE, and its menu system picks up the change automatically).

Now when you click on the "Samba" launcher, a box will pop up asking you to enter your password.

If you subsequently get errors or warnings, please ask a different question. (I did get warnings, so I think there is a problem with system-config-samba as well, but this question was about how to launch it, which I have answered).

Edit: a bug has been reported on this problem already.

2
  • I did all the things you mentioned, the launcher even picked up changes as I viewed on edit application, it asked for the password but didn't open. No signs of opening after entering the password. Aug 13, 2018 at 17:53
  • OK, let's try it a different way. Answer edited. Aug 13, 2018 at 18:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .