11

I want to restrict users on changing wallpapers and themes. So can anyone say me how to remove Change Desktop Background option from right click?

Note:

I just totally want to remove that option from right click.

2
  • This doesn't look possible without recompiling from source. I'll clone the repo and see where the code is. Jun 17, 2011 at 12:58
  • 1
    Do you want to remove access to gnome-appearance-properties entirely, or just this method of accessing it? If you want to prevent users from customizing their background or theme, you probably just want to remove access to the command entirely (require supervisor password to continue or something).
    – crazy2be
    Jun 17, 2011 at 20:06

7 Answers 7

20
+500

If you can live without icons on your desktop, you can disable right click menu entirely through Nautilus' show_desktop option like this:

gconftool-2 -t bool -s /apps/nautilus/preferences/show_desktop false

Edit: Getting rid only of that menu entry would require patching the Nautilus source. The menu definition is in src/file-manager/fm-desktop-icon-view.c inside desktop_view_entries[] (or just search for Change Desktop _Background). Edit2: See below for HowTo.

Other option would be to use different file manager to draw desktop icons. Maybe PCMan File Manager doesn't have this entry in right-click menu?

Minimal guide to editing & rebuilding Nautilus

As I've noted before, the menu entry is hardcoded to Nautilus, so as far as I know, the only way how to remove it AND keep all other functionality is to edit Nautilus' source and recompile it. Be warned that it will take some time and you'll need some space for all the development packages and compilation itself.

The process was tested with Nautilus Elementary 2.32.2.2, however there shouldn't be any differences for stock Nautilus 2.32.

  1. Get basic development packages:
    sudo apt-get install build-essential fakeroot dpkg-dev devscripts
  2. Get development dependencies for Nautilus
    sudo apt-get build-dep nautilus
  3. Download Nautilus source - note that this command doesn't require sudo; also, it'll place multiple files to current directory so it's usually good idea to create an extra dir for that.
    mkdir nautilus
    cd nautilus
    apt-get source nautilus
  4. The source will be downloaded and extracted to nautilus-VERSION* folder (VERSION is, of course some version number, most probably 2.32.something). Get into that folder.
  5. Open file src/file-manager/fm-desktop-icon-view.c
  6. Search for GtkActionEntry desktop_view_entries[] - in my case it's on line 721 however it may differ for your version. It should look like this:

    static const GtkActionEntry desktop_view_entries[] = {
        /* name, stock id */
        { "New Launcher Desktop", NULL,
          /* label, accelerator */
          N_("Create L_auncher..."), NULL,
          /* tooltip */
          N_("Create a new launcher"),
          G_CALLBACK (action_new_launcher_callback) },
        /* name, stock id */
        { "Change Background", NULL,
          /* label, accelerator */
          N_("Change Desktop _Background"), NULL,
          /* tooltip */
          N_("Show a window that lets you set your desktop background's pattern or color"),
          G_CALLBACK (action_change_background_callback) },
        /* name, stock id */
        { "Empty Trash Conditional", NULL,
          /* label, accelerator */
          N_("Empty Trash"), NULL,
          /* tooltip */
          N_("Delete all items in the Trash"),
          G_CALLBACK (action_empty_trash_conditional_callback) },
    };
    

    Note that the second array contains Change Background - remove it, so you get something like that:

    static const GtkActionEntry desktop_view_entries[] = {
        /* name, stock id */
        { "New Launcher Desktop", NULL,
          /* label, accelerator */
          N_("Create L_auncher..."), NULL,
          /* tooltip */
          N_("Create a new launcher"),
          G_CALLBACK (action_new_launcher_callback) },
        /* Change Background was here */
        /* name, stock id */
        { "Empty Trash Conditional", NULL,
          /* label, accelerator */
          N_("Empty Trash"), NULL,
          /* tooltip */
          N_("Delete all items in the Trash"),
          G_CALLBACK (action_empty_trash_conditional_callback) },
    };
    

    Save the file.

  7. Back in Terminal cd to the source root (if you haven't do so already)
    cd nautilus-*
    And run
    dch -l local
    This will execute the default $EDITOR (probably Nano) with the changelog file prepared to input your changes. Write something descriptive after the *, keep everything else intact. Note that -l local option is to note local build, you can use anything else instead of local, however it's important to add entry to changelog, otherwise your local build would be overridden by repository version.
  8. Compile and build the package
    debuild -i -us -uc -b
    For explanation of switches see debuild man page Examples section
  9. Go grab some coffee, this might take some time.
  10. Once the build finishes (hopefully with success), you'll find bunch of .deb packages in the parent directory. Install them all.
    cd ..
    sudo dpkg -i *.deb
  11. Logout or restart Nautilus for great justice...
    nautilus -q

Look ma', no "Change Background"!

nautilus desktop menu

To be 100% sure, it's probably good idea to lock nautilus package in Synaptic.

Edit: Once you've verified that everything is working fine, you can get rid of build-dep packages using this nifty command. You just need to install aptitude...

References

19
  • It will be nice, if you say how to remove that option completely from right click.
    – karthick87
    Jun 17, 2011 at 7:11
  • Ok, I'll get into how to edit the Nautilus source and recompile it. Just a little time.
    – jnv
    Jun 17, 2011 at 12:14
  • Here you go, I hope it'll be useful.
    – jnv
    Jun 17, 2011 at 13:16
  • 1
    nice one @jnv :)
    – Rinzwind
    Jun 17, 2011 at 13:18
  • Thanks Rinzwind. I see that Markdown screwed up source code from fm-desktop-icon-view.c, don't copy it yet.
    – jnv
    Jun 17, 2011 at 13:23
6

I don't know how to do that, but I presume that the desktop background is set via a GConf key. If so, you can run gconf-editor as root, find the relevant key, and set it as mandatory. Then, users won't be allowed to change its value.

4

Disclaimer: I have not used Sabayon (User Profile Editor in Ubuntu) or Pesullus (Lock Down Editor in Ubuntu). Just helping out by pointing you in the right direction. :-)

http://live.gnome.org/Sabayon/

Sabayon is a system administration tool to define and deploy desktop profiles for the GNOME desktop environment. It allows you to control such things as panel layouts, menu items, default gconf settings, as well as provide pre-defined defaults for some non-GNOME programs such as Firefox. It also makes use of the lockdown functionality of Pessulus. It does this by providing a "desktop within a window", allowing you to customize your desktop as you see fit, then recording your changes, to be applied to users by the sabayon-apply program at login time.

Who should use Sabayon? Sabayon is geared towards anyone who has need of providing a standardized GNOME desktop to their end users. Teachers who administer labs, Libraries, and Businesses all have need to have a "locked down" desktop, and can make good use of Sabayon

It is in Ubuntu Software Centre, do a search for "user profile editor" It will be placed in System>Administration>User Profile Editor

Run the program, click add button, type Student, click add, click edit, Click Help, click contents. Read the help.

Here is another site that explains it a bit more, with emphasis on a Kiosk.

http://users.telenet.be/mydotcom/howto/linuxkiosk/ubuntu01.htm

Other programs that allow you to lock down things are "Lock Down Editor" found in Ubuntu Software Centre (It is actually called Pessulus, don't know why Ubuntu calls it Lock Down Editor.)

The other is Ubuntu Tweak, found at http://ubuntu-tweak.com/

I think Sabayon (User Profile Editor in Ubuntu) will be your best bet.

P.S. Here is another discussion on your question.... http://brainstorm.ubuntu.com/item/1626/

3

For Ubuntu 11.04 and earlier, just set the gconf key as mandatory. Here's one how-to.

sudo gconftool-2 --direct --config-source \
xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string --set \
/desktop/gnome/background/picture_filename \ 
"/usr/share/backgrounds/cosmos/blue-marble-west.jpg"

For Ubuntu 11.10 and later (or using Gnome 3), set the dconf key as mandatory. See the end of this article.

0
2

By changing permissions of

sudo chmod 660 /usr/bin/gnome-appearance-properties #or any other permission

you can restrict access to modifications of theme or background properties. However this will not remove the menu entry.

2

Have you tried Gofris, this application is equal to deepfreeze on wind*ws. you probably noticed that any changes you make to their system: create or delete files, settings and so on, everything resets when you restart the computer.

do following action to install Gofris on ubuntu :

  • sudo add-apt-repository ppa:tldm217/gofris
  • sudo apt-get update
  • sudo apt-get install gofris-en

type gofris-en in terminal to running.

enter image description here

check this link : http://www.webupd8.org/2010/09/ofris-gets-appindicator-gofris-deep.html

2

I make it work with gconftool-2. Just run:

gconftool-2 --type bool --set /apps/nautilus/lockdown/disable_context_menus 1

If you need this for all users, just create a /etc/profile.d script.

You must log in to answer this question.

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