LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I run a gui program as root? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-run-a-gui-program-as-root-949450/)

paveway 06-09-2012 10:26 PM

How do I run a gui program as root?
 
I'm trying to enable samba but the program is all grayed out when I run it. I assume its cause I'm not logged in as root. How do I run it as root? I'm using Debian and I can't actually log in as root.

mannmaniyar 06-09-2012 11:26 PM

Hi,

If you know root password then you can switch to root using "su -" else try to use sudo <command> from the same user.

AwesomeMachine 06-09-2012 11:31 PM

You have to type the name of the program into a virtual terminal with root privileges, see mannmaniyar above. Most programs are in /bin, /usr/bin, /sbin, /usr/sbin. If you don't know the actual command name, put the icon on the desktop, right click the icon, click properties, and click executable

paveway 06-09-2012 11:44 PM

for some reason it is not allowing me to drag these samba configuration programs to the desktop. i have no idea why...

jschiwal 06-10-2012 12:32 AM

Quote:

Originally Posted by paveway (Post 4699783)
I'm trying to enable samba but the program is all grayed out when I run it. I assume its cause I'm not logged in as root. How do I run it as root? I'm using Debian and I can't actually log in as root.

What program? Which distro are you using?

To launch a gui program as root, use "kdesu" in KDE, or gnomesu in Gnome. This will also allow root access to your screen. However, admin programs launched from the menu will prompt you for the root password so this may not be necessary.

Are you trying to configure samba or have the service enabled?

bsat 06-10-2012 09:03 AM

you can use "sudo -i" to become root.

paveway 06-10-2012 12:47 PM

The program just says Samba - KDE Control Module. I am using Debian.

where do I run kdesu? I tried it in a terminal and got command not found.

whizje 06-10-2012 01:14 PM

From Alien Bob in Slackware don't no about Debian
Code:

echo $DISPLAY                  # you'll be needing this value 3 lines below
sudo -i                        # or "su -" on older Slackwares
xauth merge ~alien/.Xauthority # use your own username here instead of "alien"
export DISPLAY=:0.0            # use the value of DISPLAY you've seen 3 lines before

Alternatively, you can run the following two commands which will give you the same end result:

sudo -s                        # a side effect of '-s' is that it allows root to run X programs
. /etc/profile                # sourcing the global profile ensures
                              # that root has the ''sbin'' directories in the $PATH


craigevil 06-10-2012 05:22 PM

HOWTO - get kdesu back to normal in KDE4 - http://forums.debian.net/viewtopic.php?f=16&t=40158



This one is actually pretty easy. In a terminal here is what you do:
Anywhere you see ## just after that is instructions you do NOT have to type the text directly AFTER the ## signs,
what you have to type will either be BEFORE the ## on a line or the line will have NO ## signs.


Code:

  ##first type in:
    su

    ##after you hit enter you will see
    Password:        ##<----------- type in your root password here.

    ##Now you will see your prompt change from a $ to a # sign

    ##Don't worry, almost done now...

    ##type:

    ln -s /usr/lib/kde4/libexec/kdesu /usr/bin/kdesu

    ##hit enter, then type:
    exit

    ##You are now back to your regular user in your terminal. Lets test that puppy out!

    kdesu dolphin

    ##The normal kdesu dialog should pop up asking for roots password with the explanation that the program
    ##dolphin needs root permissions. You can just cancel the dialog box since it was only a test to see if the link
    ##worked.

as for samba, install and use smb4k.

jschiwal 06-17-2012 08:01 PM

You can press ALT-F2 and then enter "kdesu <program name>". If that doesn't work in other distros, I wasn't aware of it.
kdesu & gnomesu differ from sudo in that it handles xauth cookies so that the root user has access to the display. A GUI program needs that.

DavidMcCann 06-18-2012 11:28 AM

If you search the internet for "debian samba" you may find something useful. I know nothing about the program, but this looks a good place to start:
http://www.debianhelp.co.uk/samba

frankbell 06-18-2012 08:40 PM

Configuring Samba can be done quite easily though the command line and a text editor. The text editor is used to edit /etc/samba/smb.conf and the command line to add names to the /etc/smbpasswd file.

I recommend Samba by Example: http://samba.org/samba/docs/man/Samba-Guide/

In case it helps, here is a bit of my smb.conf file, which basically allows read/write access.

Code:

[global]
workgroup = workgroup
security = share
encrypt password = yes
smb passwd file = /etc/samba/smbpasswd
show add printer wizard = No
wins support = no

[sharefiles]
path = /home/[username]/[some directory]
guest ok = yes
read only = no
available = yes
browsable = yes
public = yes
writable = yes

Remember that, in addition to configuring Samba, the directories you wish to share must also have their file permissions set to allow sharing; you can do this by going the directories and setting the properties in your file manager.

Teufel 06-18-2012 09:53 PM

1 Attachment(s)
Quote:

Originally Posted by paveway (Post 4700084)
where do I run kdesu? I tried it in a terminal and got command not found.

You can get a kdesu command as discribed at post #9
Also you can add some tools to KDE Menu to run them as root.
No need to launch everytime konsole and no need to type a bunch of letters
Just click menu item:

mark_alfred 06-18-2012 11:56 PM

1 Attachment(s)
Rather than kdesu, try using gksu. Since Debian generally runs Gnome, it's likely that it has gksu. gksu is a command launcher for running programs as root. If gksu is not installed on your system, then simply install it (IE, "apt-get install gksu"), and then you can use it. Just press Alt-F2, enter "gksu", and then within the gksu launcher, enter the name of the program you wish to run as root.

John VV 06-19-2012 01:21 AM

Quote:

for some reason it is not allowing me to drag these samba configuration programs to the desktop. i have no idea why...
because you do not
kde and Gmone3 both block things being " just put" on the desktop

clean desktops IS the rule now

the desktop folder is NOT a general purpose "work bench folder"


All times are GMT -5. The time now is 12:09 AM.