PDA

View Full Version : gksu or gksudo



mick222
January 18th, 2010, 04:21 PM
I've noticed in some posts people using gksu to open gedit or another gui program as root. I always use gksudo i thought su was for changing user as root and sudo was for open as root am i wrong.

The Toxic Mite
January 18th, 2010, 04:23 PM
http://en.wikipedia.org/wiki/su_(Unix) (http://en.wikipedia.org/wiki/su_%28Unix) (copy+paste)
http://en.wikipedia.org/wiki/sudo

:)

snowpine
January 18th, 2010, 04:24 PM
I've noticed in some posts people using gksu to open gedit or another gui program as root. I always use gksudo i thought su was for changing user as root and sudo was for open as root am i wrong.

gksu and gksudo are identical (in Ubuntu anyway).

Psumi
January 18th, 2010, 04:39 PM
gksu/do is also dependant on GNOME dependencies, even though it's just a gtk app.

The Toxic Mite
January 18th, 2010, 04:40 PM
gksu/do is also dependant on GNOME dependencies, even though it's just a gtk app.

I didn't know that O_O

Psumi
January 18th, 2010, 04:42 PM
I didn't know that O_O

At least in ubuntu it is. try it on the mini.iso next time after you install xfce4. You'll see that it pulls gnome dependencies even with no-install-recommends.

sisco311
January 18th, 2010, 04:44 PM
gksu is a GUI frontend for su & sudo. gksudo is simply a symbolic link to gksu. By default, in Ubuntu it's used as a frontend for sudo, but you can use it as frontend for su, by changing the authentication mode in gksu-properties.

Both sudo and su allows a permitted user to execute a command as the superuser or another user.

Both are suid (http://en.wikipedia.org/wiki/Setuid) programs.

http://en.allexperts.com/q/Unix-Linux-OS-1064/real-effective-user-id.htm

Xbehave
January 18th, 2010, 04:44 PM
Sudo is for giving a user a some of another user (e.g roots) abilities.
Su (substitute user) is for running a command as another user (e.g root)

In ubuntu sudo is used as su, because it lets you run any command as root, the only difference is the password for su is roots and the password for sudo is your (by default, as sudo can be configured to ask for another password)

Normally with su, you launch as shell (like sudo -i) whereas with sudo you normally run a single command (su -c), but both are almost identical for a gui program (because you always launch a command)

The Toxic Mite
January 18th, 2010, 04:47 PM
BTW:

How come, when you're running a terminal as yourself, the $ sign is at the end of the prompt, but when you're running as root, there's a # sign at the end??

I'm still pretty new to *nix lol

Xbehave
January 18th, 2010, 04:55 PM
At least in ubuntu it is. try it on the mini.iso next time after you install xfce4. You'll see that it pulls gnome dependencies even with no-install-recommends.
Cry me a river, are you going to bring this up everywhere? You never did explain what was so vital about having a "pure xfce" install yet you couldn't be bothered to recompile gksu without gnome enhancements or reimplement the relevant gnome libs yourself.

CharlesA
January 18th, 2010, 04:55 PM
BTW:

How come, when you're running a terminal as yourself, the $ sign is at the end of the prompt, but when you're running as root, there's a # sign at the end??

I'm still pretty new to *nix lol

Lets you know that you are in a child shell (or root shell, not sure which).

mick222
January 18th, 2010, 04:58 PM
Sudo is for giving a user a some of another user (e.g roots) abilities.
Su (substitute user) is for running a command as another user (e.g roo

Thx I think i understand now so in ubuntu it doesn't really matter whether you use su or sudo, but in other linux os's su makes you root until you exit the terminal. and sudo just executes the command as root.

Xbehave
January 18th, 2010, 04:58 PM
How come, when you're running a terminal as yourself, the $ sign is at the end of the prompt, but when you're running as root, there's a # sign at the end??
That's a convenient (but not full proof) way to tell, basically if your $PS1 environmental variable, contains a \$ it will be substituted according to those rules (\u will be subbed for your username anyway which is probably an easier way to tell)

CharlesA
January 18th, 2010, 05:02 PM
That's a convenient (but not full proof) way to tell, basically if your $PS1 environmental variable, contains a \$ it will be substituted according to those rules (\u will be subbed for your username anyway which is probably an easier way to tell)

Thanks for the info.

sisco311
January 18th, 2010, 05:04 PM
Thx I think i understand now so in ubuntu it doesn't really matter whether you use su or sudo, but in other linux os's su makes you root until you exit the terminal. and sudo just executes the command as root.

By default, su starts a root shell, while sudo, by default, runs a single command as root.

su prompts for the target user's password, while sudo, by default, prompts for the invoking user's password.

For more details read the man pages:

man su
man sudo

cariboo
January 18th, 2010, 06:18 PM
Thx I think i understand now so in ubuntu it doesn't really matter whether you use su or sudo, but in other linux os's su makes you root until you exit the terminal. and sudo just executes the command as root.

Su stands for switch user, so you can use it to switch to any other user on you computer, not only root. If you thave three users on your system:


Tom
****
Harry


you can switch to any one of them using su eg:


su Harry

will ask you for Harry's password, you can then run as Harry. The same for Tom and ****.

alexfish
January 18th, 2010, 06:38 PM
I use gksudo nautilus to change prefs

Marvin666
January 18th, 2010, 07:45 PM
That symbol is a warning, it's what you'll turn your hard drive into if you're not careful (hash).

mick222
January 18th, 2010, 09:57 PM
Su stands for switch user, so you can use it to switch to any other user on you computer, not only root. If you thave three users on your system:

* Tom
* ****
* Harry


Yes thats what i thought . The reason I asked this question was a while ago i tried to use sudo to open firefox "forgot to out the gk" and mucked it up a bit . I know that in suse or fedora if you use su you can change user or become root just wondered hat the difference was when their is no root user.I think this has bee answered thx everybody.

sisco311
January 18th, 2010, 11:00 PM
Yes thats what i thought . The reason I asked this question was a while ago i tried to use sudo to open firefox "forgot to out the gk" and mucked it up a bit .


http://psychocats.net/ubuntu/graphicalsudo

By default, sudo doesn't reset the HOME environment variable. Some applications (like firefox) use this variable to identify the user's home directory. So, if you use sudo to run this applications (mostly GUI apps), you may end up with files owned by root in your home directory.

gksu is designed for GUI apps and resets the HOME variable.

You can also use sudo -i command or manually reset the variable sudo HOME=/root command.





I know that in suse or fedora if you use su you can change user or become root just wondered hat the difference was when their is no root user.I think this has bee answered thx everybody.

There is a root user in Ubuntu, but the root user's password is locked. That's why you can't directly login as root or su to root.