Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to make my Dropbox directory secure from unwitting changes. So I made for my directory and files inside the following actions:

chown -R dropbox:dropbox Dropbox

The idea is that I work under a common user, let's name it USER. And I start dropbox as dropbox user:

sudo -u dropbox dropbox start

But there is an error and I don't know how to handle it:

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

How can I create a new user properly, in a way that achieves this goal? Currently the only configuration files in /home/dropbox directory are from /etc/skel/ directory.

UPDATE To the suggestion of Eliah Kagan:

I cannot start dropbox with gksu, when I am trying to do that I get this:

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

Under dropbox user:

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

This errors tell that something is wrong with the user graphics environment configuration.

share|improve this question

2 Answers 2

The Dropbox client you are using requires access to an X session, which your user doesn't have. There is an official Dropbox CLI that may do the trick for you, but mileage may vary.

share|improve this answer
    
I know about CLI client, but I want use GUI version. Thx. –  user14416 Jul 27 '12 at 11:04

As Bryan Agee has said, dropbox is a graphical program, so you should not use sudo directly to run it as root.

However, you shouldn't have any problems running programs graphically as another user, so long as you do it correctly:

gksu -u dropbox dropbox start

To be clear, this should work, where sudo -u ... doesn't. (Preventing the creation of root-owned--or in this case, dropbox-owned--configuration files in your home directory is not the only difference between gksu/gksudo and sudo; the former also handles .Xauthority properly, which is probably what's preventing you from "access[ing] the X Display.")

share|improve this answer
    
I used sudo for other programs with GUI before many times. "This prevents files in your home directory becoming owned by Root" - I suppose that it is the main distinguishment from sudo. But I don't care about it, because I work in the home directory of a dropbox user. –  user14416 Jul 27 '12 at 11:03
    
@user14416 Have you tried this with gksu? See edit. –  Eliah Kagan Jul 27 '12 at 16:57
    
FYI: it worked when i did : gksudo python /var/tmp/p.py –  YumYumYum Dec 10 '12 at 6:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.