启动samba时出现错误

我正在使用Xubuntu 18.04并在启动Samba时遇到错误“无法执行命令gksu system-config-samba”请帮助。 我是初学者。

打开终端并运行以下命令:

sudo touch /etc/libuser.conf 

然后运行此命令以启动应用程序:

 sudo -H system-config-samba 

编辑:要从菜单启动它:

**在以下位置创建一个新文件:/usr/share/polkit-1/actions/com.ubuntu.pkexec.samba.policy

添加它:

     Authentication is required to run the Samba Server Settings samba  auth_admin auth_admin auth_admin  /usr/sbin/system-config-samba true  

**在/usr/share/applications/system-config-samba.desktop编辑启动器

找到这一行:Exec = gksu system-config-samba

替换为此行:Exec = pkexec system-config-samba

注意:对于以下内容来说,这似乎有些过分:

(1)一年可能会使用一次或两次。

(2)最终将从存储库中删除: https : //bugs.launchpad.net/ubuntu/+source/system-config-samba/+bug/1740419

看起来system-config-samba.desktop中存在错误,因为它仍然使用18.04不支持的’gksu’。

首先让我们解决这个问题。

(编辑)的

创建一个脚本文件,您可以在其中保留脚本。 我将它们保存在~/scripts所以我称之为~/scripts/samba-pkexec 。 在此文件中添加该行

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

退出,保存你的工作。

确保该文件具有可执行权限(使用文件管理器或命令行)。

使用您选择的方法,将/usr/share/applications/system-config-samba.desktop复制到~/.local/share/applications

然后在您选择的编辑器中打开~/.local/share/applications/system-config-samba.desktop ,找到看起来像这样的行

 Exec=gksu system-config-samba 

并将其更改为

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

退出,保存你的工作。

做任何你需要做的事情,以使你的桌面接受改变。 (我使用LXDE,其菜单系统自动获取更改)。

现在,当您单击“Samba”启动器时,将弹出一个框,要求您输入密码。

如果您随后收到错误或警告,请提出其他问题。 (我确实得到了警告,所以我认为system-config-samba也有问题,但这个问题是关于如何启动它,我已经回答了)。

编辑:已经报告了此问题的错误 。