新用户配置

新用户配置

我想确保我的 Dropbox 目录不会受到无意更改。因此,我对目录和文件执行了以下操作:

chown -R dropbox:dropbox Dropbox

我的想法是,我在一个普通用户下工作,我们将其命名为 USER。然后我以 dropbox 用户身份启动 dropbox:

sudo -u dropbox dropbox start

但是有一个错误,我不知道如何处理:

Unable to access the X Display, is $DISPLAY set properly?

我怎样才能正确地创建新用户以实现此目标?当前/home/dropbox目录中的唯一配置文件来自/etc/skel/目录。

更新 Eliah Kagan 的建议:

我无法使用 gksu 启动 dropbox,当我尝试这样做时,出现以下信息:

gksu -u dropbox dropbox start -i
gksu: option requires an argument -- 'i'

在 dropbox 用户下:

dropbox start -i
Starting Dropbox...No protocol specified
No protocol specified
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
warnings.warn(str(e), _gtk.Warning)
/usr/bin/dropbox:406: Warning: invalid (NULL) pointer instance
  title = "Dropbox Installation")
/usr/bin/dropbox:406: Warning: g_signal_connect_data: assertion     `G_TYPE_CHECK_INSTANCE (instance)' failed
  title = "Dropbox Installation")
/usr/bin/dropbox:414: GtkWarning: IA__gtk_settings_get_for_screen: assertion     `GDK_IS_SCREEN (screen)' failed
  self.ok = ok = gtk.Button(stock=gtk.STOCK_OK)
/usr/bin/dropbox:414: Warning: g_object_get: assertion `G_IS_OBJECT (object)'     failed
  self.ok = ok = gtk.Button(stock=gtk.STOCK_OK)
/usr/bin/dropbox:414: Warning: value "TRUE" of type `gboolean' is invalid or     out of range for property `visible' of type `gboolean'
  self.ok = ok = gtk.Button(stock=gtk.STOCK_OK)
/usr/bin/dropbox:419: GtkWarning: IA__gtk_settings_get_for_screen: assertion     `GDK_IS_SCREEN (screen)' failed
  cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
/usr/bin/dropbox:419: Warning: g_object_get: assertion `G_IS_OBJECT (object)'     failed
  cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
/usr/bin/dropbox:419: Warning: value "TRUE" of type `gboolean' is invalid or out of range for property `visible' of type `gboolean'
  cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
/usr/bin/dropbox:486: GtkWarning: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window
  dialog.show()
/usr/bin/dropbox:486: GtkWarning: IA__gdk_pango_context_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_context_set_font_description: assertion `context != NULL' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_context_set_base_dir: assertion `context != NULL' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_context_set_language: assertion `context != NULL' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_layout_new: assertion `context != NULL' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_layout_set_text: assertion `layout != NULL' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_layout_set_attributes: assertion `layout != NULL' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_layout_set_alignment: assertion `layout != NULL' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_layout_set_ellipsize: assertion `PANGO_IS_LAYOUT (layout)' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_layout_set_single_paragraph_mode: assertion `PANGO_IS_LAYOUT (layout)' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_layout_set_width: assertion `layout != NULL' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_layout_get_extents: assertion `layout != NULL' failed
  dialog.show()
/usr/bin/dropbox:486: PangoWarning: pango_layout_set_wrap: assertion `PANGO_IS_LAYOUT (layout)' failed
  dialog.show()
/usr/bin/dropbox:486: GtkWarning: IA__gdk_screen_get_default_colormap: assertion `GDK_IS_SCREEN (screen)' failed
  dialog.show()
/usr/bin/dropbox:486: GtkWarning: IA__gdk_colormap_get_visual: assertion `GDK_IS_COLORMAP (colormap)' failed
  dialog.show()
/usr/bin/dropbox:486: GtkWarning: IA__gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed
  dialog.show()
/usr/bin/dropbox:486: GtkWarning: IA__gdk_window_new: assertion `GDK_IS_WINDOW (parent)' failed
  dialog.show()
Segmentation fault

此错误表明用户图形环境配置有问题。

答案1

您正在使用的 Dropbox 客户端需要访问 X 会话,但您的用户没有该会话的权限。有一个官方的 Dropbox CLI这可能对你有帮助,但效果可能会有所不同。

答案2

正如 Bryan Agee 所说,dropbox这是一个图形程序,因此你不应sudo直接使用以 root 身份运行它。

但是,只要您操作正确,以另一个用户身份以图形方式运行程序就不会有任何问题:

gksu -u dropbox dropbox start

需要明确的是,这应该可行,其中sudo -u ...没有。(阻止在中创建root-owned(或在本例中dropbox为 -owned)配置文件你的主目录并不是gksu/gksudo和之间的唯一区别sudo;前者也能.Xauthority正确处理,这可能是阻止您“访问 X 显示器”的原因。)

相关内容