LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 09-10-2005, 04:37 AM   #1
hungrigerhaifisch
Member
 
Registered: Aug 2005
Distribution: Arch Linux
Posts: 91

Rep: Reputation: 15
Question openbox & sudo


I am trying to set a default background image in openbox.
To achieve this, I (at a terminal) type:
Code:
sudo feh --bg-scale /path/to/image
Works perfectly.
Now obviously I don't want to type this everytime I log in, so I added the command to my .xinitrc file.
The problem is, that I cannot use sudo, as my password is required and I cannot pass this to the startx script, without running it as sudo, which I don't want to do.
Without sudo, the image is not applied as my user has no permission to do so.
I would like to know, how I could modify the "/etc/sudoers" file, so that my default user can run only the command in question, without having to enter the password.
I have tried:
Code:
username    ALL = NOPASSWD: ALL
which gives the desired effect, with the backdraw of posing a huge security risk as anyone using my pc could just do a "sudo rm -r /usr"
Or can I solve this problem, by adding my user to a different group?
 
Old 09-11-2005, 10:47 AM   #2
Sargek
Member
 
Registered: Jan 2003
Location: San Antonio, Texas
Distribution: Debian testing
Posts: 416

Rep: Reputation: 36
Re: openbox & sudo

Quote:
Originally posted by hungrigerhaifisch
I am trying to set a default background image in openbox.
To achieve this, I (at a terminal) type:
Code:
sudo feh --bg-scale /path/to/image
Works perfectly.
Now obviously I don't want to type this everytime I log in, so I added the command to my .xinitrc file.
The problem is, that I cannot use sudo, as my password is required and I cannot pass this to the startx script, without running it as sudo, which I don't want to do.
Without sudo, the image is not applied as my user has no permission to do so.
I would like to know, how I could modify the "/etc/sudoers" file, so that my default user can run only the command in question, without having to enter the password.
I have tried:
Code:
username    ALL = NOPASSWD: ALL
which gives the desired effect, with the backdraw of posing a huge security risk as anyone using my pc could just do a "sudo rm -r /usr"
Or can I solve this problem, by adding my user to a different group?
Just out of curiousity, why must you use sudo to set wallpaper? The background settings are owned by the currently logged in user, and sudo is not required.
 
Old 09-12-2005, 03:48 AM   #3
boxerboy
Member
 
Registered: Jul 2005
Distribution: ubuntu5.04, ubuntu5.10, suse9.3, mandrake10.1, mandriva2006(beta), FC1-4, redhat9.0, debian sarge
Posts: 519

Rep: Reputation: 32
is it not easier to set wall paper through the configure desktop page? im assuming openbox has the config desktop area somewhere.
 
Old 09-12-2005, 02:43 PM   #4
hungrigerhaifisch
Member
 
Registered: Aug 2005
Distribution: Arch Linux
Posts: 91

Original Poster
Rep: Reputation: 15
Unhappy I thought as much...

Quote:
...why must you use sudo to set wallpaper? The background settings are owned by the currently logged in user, and sudo is not required.
Well thats what I thought, BUT I am afraid that my box (or rather X) is telling me differently.
If I enter
Code:
feh --bg-scale /path/to/image
(note, no sudo) nothing happens. The same line with sudo, and my background image is set!

Now it seems logical, that the same behaviour applies to X, when it executes what is written in the .xinitrc file.
Without sudo, X starts (and Openbox) but no background image, with sudo, X starts but just sits there doing nothing (no Openbox). Terminating the X server reveals, that it is waiting for a password. Now if I, before running the startx-script do a
Code:
sudo aptitude
or any other sudo command (and enter my password), and then run
Code:
startx
the X-Server fires up, sets my background image, and runs Openbox.

Now either this is a bug, (I am running Ubuntu Breezy!) or I am missing something crucial.
Quote:
is it not easier to set wall paper through the configure desktop page? im assuming openbox has the config desktop area somewhere.
Sadly, this is not the case, as neither the themes nor openbox itself set a background image.
One has to use a 'third-party-tool', such as feh!
 
Old 10-02-2005, 10:22 AM   #5
Sargek
Member
 
Registered: Jan 2003
Location: San Antonio, Texas
Distribution: Debian testing
Posts: 416

Rep: Reputation: 36
wallpaper

Hmmm. You are not running as root, correct? I've never seen this behavior before. The user you are running as should be able to run startx and feh with no problems. Openbox is a minimal window manager, and provides no capability to manage wallpaper. Openbox does have a theme and setting manager called "obconf", but it must be installed seperately, and does not manage wallpaper. A full-blown desktop environment like Xfce4, Gnome or KDE will provide functionality to alter the desktop, but they are much larger, slower, and use far more system resources. If this is not an issue to you, perhaps using a full desktop environment is better. I am not familiar with Ubuntu at all, so cannot give you any distro-specific help - sorry about that.
 
Old 10-02-2005, 06:37 PM   #6
hungrigerhaifisch
Member
 
Registered: Aug 2005
Distribution: Arch Linux
Posts: 91

Original Poster
Rep: Reputation: 15
Quote:
...but they are much larger, slower, and use far more system resources....
Sadly this IS an issue for me.
On my "real" machine, I use GNOME, but of course 1800Mhz and 512MBs of Ram are more than enough to do so...the machine in question is my old 300Mhz Laptop, and OpenBox, being even more lightweight than blackbox or fluxbox (and still pretty!) is just right for it.
Quote:
You are not running as root, correct? I've never seen this behavior before...
Actually, I've by now figuered, that X is behaving quite normal. If You have GDM XDM or KDM installed, try running them as a normal user, it should give you something like, "only root wants to run GDM".
So my solution (not tested yet) is probably to install either GDM or XDM, the latter being less dependent on Resource hogging GNOME, and let it do all the setting up.

When I find time, I'll post the result!
 
Old 10-02-2005, 07:04 PM   #7
Sargek
Member
 
Registered: Jan 2003
Location: San Antonio, Texas
Distribution: Debian testing
Posts: 416

Rep: Reputation: 36
X

Quote:
Originally posted by hungrigerhaifisch
Sadly this IS an issue for me.
On my "real" machine, I use GNOME, but of course 1800Mhz and 512MBs of Ram are more than enough to do so...the machine in question is my old 300Mhz Laptop, and OpenBox, being even more lightweight than blackbox or fluxbox (and still pretty!) is just right for it.

Actually, I've by now figuered, that X is behaving quite normal. If You have GDM XDM or KDM installed, try running them as a normal user, it should give you something like, "only root wants to run GDM".
So my solution (not tested yet) is probably to install either GDM or XDM, the latter being less dependent on Resource hogging GNOME, and let it do all the setting up.

When I find time, I'll post the result!
Do you boot to a command line and then run startx? I know GDM/KDM/XDM need to be run as root, because they normally run as a system service. How frustrating - sorry, the only thing I can think of is a problem with the permissions of your ~/.Xauthority file, but I am kind of grabbing at straws.
 
Old 10-05-2005, 08:43 PM   #8
davideckels
LQ Newbie
 
Registered: Jun 2005
Posts: 6

Rep: Reputation: 0
set background in openbox

i have an imperfect fix- i edited my menu.xml to include a section for backgrounds, then added an action menu entry for each background i like.

so, in

/etc/xdg/openbox/menu.xml

i added:

<menu id="background-menu" />

to my list of submenus and:

<menu id="background-menu" label="backgrounds">
<item label="wallpaper-name">
<action name="Execute"><execute>bsetbg -full /path/to/wallpapers/wallpaper-name.jpg</execute></action>
</item>
</menu>

with a spearate entry for each of the backgrounds i want to rotate.

it's a little kludgy, but a good googling of "openbox ubuntu default background" suggests this may be the best kludgy workaround available.

let me know if you figure out why a sinple xinitrc file doesn't work, won't you?
 
Old 10-06-2005, 04:33 AM   #9
Sargek
Member
 
Registered: Jan 2003
Location: San Antonio, Texas
Distribution: Debian testing
Posts: 416

Rep: Reputation: 36
Re: set background in openbox

Quote:
Originally posted by davideckels
i have an imperfect fix- i edited my menu.xml to include a section for backgrounds, then added an action menu entry for each background i like.

so, in

/etc/xdg/openbox/menu.xml

i added:

<menu id="background-menu" />

to my list of submenus and:

<menu id="background-menu" label="backgrounds">
<item label="wallpaper-name">
<action name="Execute"><execute>bsetbg -full /path/to/wallpapers/wallpaper-name.jpg</execute></action>
</item>
</menu>

with a spearate entry for each of the backgrounds i want to rotate.

it's a little kludgy, but a good googling of "openbox ubuntu default background" suggests this may be the best kludgy workaround available.

let me know if you figure out why a sinple xinitrc file doesn't work, won't you?
I have a script I downloaded that will accomplish the same thing, but it involves installing Ruby, which is a scripting language. No big deal, just might not be something you want to do. Here is another option: have you heard of the file manager Rox? You can run Rox in your .xinitrc, and it can provide a desktop for you, including icons and wallpaper. It's very lightweight, and plays nicely with Openbox. It has some disadvantages, but only with other apps that insist on drawing directly to the root window.

I still cannot understand why you cannot set your own wallpaper from .xinitrc - that's very odd. Your normal user is in the "users" group, correct? Not that it really matters, but this seems like a permissions thing. Your normal user should be able to run any executable in /usr/bin or /usr/local/bin. Bsetbg should be located in /usr/bin, which any user in the "users" group has rights to execute. Can you check your /etc/group file to see of your normal user is part of the "users" group?
 
Old 10-06-2005, 05:47 PM   #10
davideckels
LQ Newbie
 
Registered: Jun 2005
Posts: 6

Rep: Reputation: 0
quoted:
I still cannot understand why you cannot set your own wallpaper from .xinitrc - that's very odd. Your normal user is in the "users" group, correct? Not that it really matters, but this seems like a permissions thing. Your normal user should be able to run any executable in /usr/bin or /usr/local/bin. Bsetbg should be located in /usr/bin, which any user in the "users" group has rights to execute. Can you check your /etc/group file to see of your normal user is part of the "users" "group?"

replied:
i just added myself to "users". let's try this again... (keystrokes, creak of shifting electrons) nope. not with an .xinitrc or an .xsession file, set as a regular file or an executable, with my group as "users" or otherwise.
...handy info:
user dave, groups... include "users"
ubuntu breezy
2.6.12-9-686-smp from install cdrom
openbox 3.2-7 from synaptic universe/X11
xorg 6.8.2-60 from install cdrom
generic nv driver from install cdrom
... what else can i tell you?

thanks for giving this some time.
-dave
 
Old 10-07-2005, 05:22 AM   #11
Sargek
Member
 
Registered: Jan 2003
Location: San Antonio, Texas
Distribution: Debian testing
Posts: 416

Rep: Reputation: 36
Sudo

David,

Well, here is a solution you might try, but is still not optimum because your normal user should be able to run any binary in /usr/bin. There is still a problem with your system, but this may work: run "visudo" (without the quotes, and as root). This will allow you to edit your /etc/sudoers file and add your user's permissions to run startx.

Code:
username hostname=NOPASSWD:/path/to/binary
Obviously, substitute your username hostname and /path/to/binary for the appropriate values. visudo will run whatever editor is set in your system wide editor variable, which may actually be vi. Vi is a minion of the devil (just kidding), and I cannot tell you how to do anything in vi - it is very difficult for a first time user to use, at least for me. You cannot edit /etc/sudoers with a text editor, you must use visudo. As an alternative to using the masochistic vi, you may set your EDITOR variable in /etc/profile first, choosing an editor which is easier to use, such as nano or pico. Once you make changes to /etc/profile, you will need to log out/in to see the changes. After that, you can run visudo and add the line above to the file. Once you save the file, visudo will exit and update /etc/sudoers. This is not a perfect solution, and still means something is hosed in your system, although for the life of me I cannot figure out what.

An alternative might be to install GDM/XDM. Have you considered this? Good luck....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM
Ph&#7909;c h&#7891;i d&#7919; li&#7879;u b&#7883; m&#7845;t???, c&#7913; pollsite General 1 06-27-2005 12:39 PM
GDM + Openbox & pypanel skybl4ck Linux - General 0 03-13-2005 09:34 PM
Perl & Sudo Problem mclard Linux - Newbie 4 12-03-2004 08:32 AM
SUDO & Perl mclard Programming 1 12-02-2004 12:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 04:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration