PDA

View Full Version : not clear on sudo



axel_2078
Dec 4th 2005, 10:30 AM
I'm confused as to how sudo works. I've already read the info in the Ubuntu wiki, but it still isn't clear to me.* I'm guessing you must use sudo whenever you need to run a root-level command.* I'm used to doing su, running the command(s) and exiting.* Are you unable to do this in Kubuntu?* I also didn't understand the part about enabling and disabling the root password.* How does sudo tie into that?

Also, what's the difference between sudo and kdesu?

Nirvana
Dec 4th 2005, 03:11 PM
Sudo is like su, except it doesn't turn the whole shell into a root shell (although you could make it do that too). It's just a quick root command. This is good for people who may accidentally forget to exit the su command. You can enable su in Kubuntu, but there's no need to since you can sudo instead. Like, lets say you want to edit your sources.list file (for apt-get).
The su way:

su
password: ******
kwrite /etc/apt/sources.list
exit
Now, if you forget to exit, you may be in a world of trouble if someone comes onto your computer and messes up stuff. The same goes with a graphical root login (which is also disabled btw, but you can enable it, read the guide for that).
Now in sudo:

sudo kwrite /etc/apt/sources.list
password: ******
and after you press <enter/return> the su action will perform, and exit automatically.

And kdesu (KDE super user?) is used when you want to run a graphical app. Such as konqueror, systemsettings, etc, as root. Sudo is mostly used for commands, such as sudo apt-get install <package name> or sudo apt-get update

whoiam55
Dec 4th 2005, 03:17 PM
you can use sudo for running command from console. You must not run GUI application with sudo. use kdesu for running GUI applications.

sudo is kinda like su. you can think sudo as "Do this thing as su (Super user)". As for disabling/enabling root password. Root password is disabled by default in kubuntu. You must use sudo/kdesu for run programs as root. This is done for a security reason. If root password is disabled you/nobody can't login as root. so there is no chances that someone can gusse your root password or can to run a brute force attack against your root account to crack your root password.

sudo is quite easy to use, once you become habitual to it.

aysiu
Dec 4th 2005, 03:47 PM
Here's the difference:


su
password:
apt-get update
apt-get install whatever
exit
exit


sudo apt-get update
password:
sudo apt-get install whatever
exit

The idea (whether you like it or not is another issue) is that you have to be consciously aware of every action you type in that requires root privileges because you're always typing sudo in front of it, and you don't have to remember to exit out of sudo (the privileges will time out in fifteen minutes--and you can change the timeout length as well).

For more on this: https://wiki.ubuntu.com/RootSudo

Djem
Dec 4th 2005, 05:07 PM
you can type 'sudo su' if you want to use the su command.

axel_2078
Dec 8th 2005, 03:09 AM
Thanks for the info, guys. :)