LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-18-2009, 11:50 PM   #1
joutlancpa
Member
 
Registered: Apr 2009
Location: Orlando, FL
Distribution: Scientific Linux 6 x64
Posts: 211
Blog Entries: 1

Rep: Reputation: 31
how do I launch programs as root under my login?


and not get this:

Code:
bash-3.1$ su
Password: 
bash-3.1# thunar
No protocol specified
Thunar: cannot open display: 
bash-3.1#
I'd like to keep it that way, i.e. fakeroot or whatever thanks!
 
Old 04-19-2009, 12:45 AM   #2
C-Sniper
Member
 
Registered: Dec 2006
Distribution: Slackware
Posts: 507

Rep: Reputation: 33
Quote:
Originally Posted by thezoid View Post
and not get this:

Code:
bash-3.1$ su
Password: 
bash-3.1# thunar
No protocol specified
Thunar: cannot open display: 
bash-3.1#
I'd like to keep it that way, i.e. fakeroot or whatever thanks!
IF you are trying to open a windowed program try the 'sudo' command. Just make sure that you are in the /etc/sudoers file
 
Old 04-19-2009, 01:16 AM   #3
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,716
Blog Entries: 3

Rep: Reputation: 483Reputation: 483Reputation: 483Reputation: 483Reputation: 483
In slackware you need to run it through the run command I tested it for you.
Quote:
kdesu thunar
then put your password in at the prompt.
 
Old 04-19-2009, 04:03 AM   #4
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
If you don't want to use kdesu because you're running xfce, you could run this:

As a normal user, to give permissions to other local users (like root) to use the X server:

Code:
xhost local:
As root, setting up the display environment variable and launching a program:

Code:
export DISPLAY=:0
thunar
 
Old 04-19-2009, 01:41 PM   #5
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
As mentioned, the traditional method is to use su or sudo. This works well for command line tools but not always with GUI tools.

For GUI tools, perhaps the following will help:

Using the Konqueror File Manager With Root Privileges

The how-to is KDE-centric, but the principles should apply to other desktops.
 
Old 04-19-2009, 02:57 PM   #6
joutlancpa
Member
 
Registered: Apr 2009
Location: Orlando, FL
Distribution: Scientific Linux 6 x64
Posts: 211

Original Poster
Blog Entries: 1

Rep: Reputation: 31
thanks...I'll look at that link in depth...oh yeah, how do I add myself to etc/sudoers? sorry, still in a learning phase...
 
Old 04-19-2009, 04:08 PM   #7
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,443

Rep: Reputation: 73
there's also gksu as a non-kde alternative
 
Old 04-19-2009, 04:24 PM   #8
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
Mine /etc/sudoers looks like:

Code:
Defaults    timestamp_timeout = 0

User_Alias  FULL = thezoid
User_Alias  PART = w1k0

Cmnd_Alias  KILL = /bin/kill, /bin/killall
Cmnd_Alias  HALT = /sbin/reboot, /sbin/halt, /usr/local/bin/suspend
Cmnd_Alias  PRINT = /usr/bin/lpr, /usr/bin/lpq, /usr/bin/lprm

root ALL =  (ALL) ALL

FULL ALL =  NOPASSWD: KILL, HALT, \
                      PRINT

PART ALL =  PASSWD:   KILL, HALT, \
            NOPASSWD: PRINT
To edit yours use command visudo.
 
Old 04-19-2009, 04:49 PM   #9
joutlancpa
Member
 
Registered: Apr 2009
Location: Orlando, FL
Distribution: Scientific Linux 6 x64
Posts: 211

Original Poster
Blog Entries: 1

Rep: Reputation: 31
thanks...I uncommented my sudoers file using VI, uncommented two lines so it all works now....thanks for the assistance.
 
Old 04-19-2009, 09:31 PM   #10
Peacepunk
Member
 
Registered: Apr 2006
Location: Cambodia
Distribution: Slackware 12.2 &... VirtualBox!
Posts: 51

Rep: Reputation: 16
Hi there;

My simplest, fastest way to do it without fiddling with DISPLAY or /etc/sudoers is as follows:

Quote:
su -c '<nameofexecutable>'
the -c here of course refers to command, see su --help for details. Don't forget to surround your actual command with ''s.

So, in real life, if I want to get thunar as root for some bossy file management, it makes:

Quote:
su -c 'thunar'
And it's nice at that because it displays a big red banner reminding you of your granted powers

AFAIK this is distro agnostic, works for me with Slack 12.2 and lots of Fedora's.

Cheers

Jean-Philippe

Last edited by Peacepunk; 04-19-2009 at 10:12 PM. Reason: !overstatment!
 
Old 04-19-2009, 09:43 PM   #11
joutlancpa
Member
 
Registered: Apr 2009
Location: Orlando, FL
Distribution: Scientific Linux 6 x64
Posts: 211

Original Poster
Blog Entries: 1

Rep: Reputation: 31
Quote:
Originally Posted by w1k0 View Post
Mine /etc/sudoers looks like:

Code:
Defaults    timestamp_timeout = 0

User_Alias  FULL = thezoid
User_Alias  PART = w1k0

Cmnd_Alias  KILL = /bin/kill, /bin/killall
Cmnd_Alias  HALT = /sbin/reboot, /sbin/halt, /usr/local/bin/suspend
Cmnd_Alias  PRINT = /usr/bin/lpr, /usr/bin/lpq, /usr/bin/lprm

root ALL =  (ALL) ALL

FULL ALL =  NOPASSWD: KILL, HALT, \
                      PRINT

PART ALL =  PASSWD:   KILL, HALT, \
            NOPASSWD: PRINT
To edit yours use command visudo.
I think I'm going to edit my sudoers file more like yours...right now it's just sudo this and sudo that...no password needed....who knows
 
Old 04-19-2009, 09:44 PM   #12
joutlancpa
Member
 
Registered: Apr 2009
Location: Orlando, FL
Distribution: Scientific Linux 6 x64
Posts: 211

Original Poster
Blog Entries: 1

Rep: Reputation: 31
Quote:
Originally Posted by Peacepunk View Post
Hi there;

the simplest, fastest way to do it without fiddling with DISPLAY or /etc/sudoers is as follows:



the -c here of course refers to command, see su --help for details

So, in real life, if I want to get thunar as root for some bossy file management, it makes:



And it's nice at that because it displays a big red banner reminding you of your granted powers

AFAIK this works anywhere, anytime, and is distro agnostic.

Cheers

Jean-Philippe
Jean...I can't get that to work on my machine like that ? don't know why (yet) ...thanks
 
Old 04-19-2009, 10:09 PM   #13
Peacepunk
Member
 
Registered: Apr 2006
Location: Cambodia
Distribution: Slackware 12.2 &... VirtualBox!
Posts: 51

Rep: Reputation: 16
?? I've got both my slack 12.2 box running Enlightenment DR16 and my wife's Fedora10-gnome lappie right in front of me doing it, and I can't remember for how long I have used that trick... Precisely, using thunar as my rootly powered file manager for when I need to...

the only trap here is not to forget the ' - how do you call that in english?

can you post the output of su --help ? maybe you have a strange/tweaked version...

[I'll update my post to make it less definitive then, sorry about that]

Cheers
J.-Philippe.
 
Old 04-19-2009, 10:40 PM   #14
joutlancpa
Member
 
Registered: Apr 2009
Location: Orlando, FL
Distribution: Scientific Linux 6 x64
Posts: 211

Original Poster
Blog Entries: 1

Rep: Reputation: 31
yes...here is that output Jean:

Code:
bash-3.1$ su --help
Password: 
GNU bash, version 3.1.17(2)-release-(i486-slackware-linux-gnu)
Usage:	/bin/bash [GNU long option] [option] ...
	/bin/bash [GNU long option] [option] script-file ...
GNU long options:
	--debug
	--debugger
	--dump-po-strings
	--dump-strings
	--help
	--init-file
	--login
	--noediting
	--noprofile
	--norc
	--posix
	--protected
	--rcfile
	--restricted
	--verbose
	--version
	--wordexp
Shell options:
	-irsD or -c command or -O shopt_option		(invocation only)
	-abefhkmnptuvxBCHP or -o option
Type `/bin/bash -c "help set"' for more information about shell options.
Type `/bin/bash -c help' for more information about shell builtin commands.
Use the `bashbug' command to report bugs.
bash-3.1$
 
Old 04-19-2009, 11:08 PM   #15
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
The problem appears to be when you boot into runlevel 4 - i.e. into X. I always boot into runlevel 3 and run startx to run KDE. I also use su -c to run anything I like in X and it works fine. As an experiment I changed my default runlevel to 4 and booted into X. The problems thezoid is having then happened to me too. KDESU still worked as it always does - I don't like sudo so didn't bother setting that up.

Seems like booting into runlevel 4 is missing out on setting some environment variable in Slackware but I haven't looked into it as I prefer to boot to the cli. Maybe something in /etc/profile or /etc/profile.d/ is causing the difference. Possibly startx itself sets something but as I say I've not really looked into it.
 
  


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
Finding out how to launch programs bzachd Red Hat 4 01-13-2008 09:59 PM
auto launch programs at login desmondtm Linux - Newbie 1 12-01-2005 04:51 PM
can't launch programs as root Error1312 SUSE / openSUSE 3 02-10-2005 11:28 AM
Unable to launch X apps with non login root shell kc00l Slackware 2 11-24-2003 03:32 AM
How to launch new programs ? mdcooper Linux - Newbie 3 03-04-2003 10:34 AM

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

All times are GMT -5. The time now is 04:39 PM.

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