[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Changes to apt-get



David R. Litwin wrote:

> How do I make a change to the source.list (for example) with my
> regular login? I need su privelages. Can it be done from Kate or
> Kwrite? Or, do I need command-line? If so, how?
>
Within a terminal window, run "su -" and provide the root password. At
this point you've become root, and you can use a console-based text
editor, such as vi, vim, nano, mcedit, joe, etc etc etc, to edit the
file. When you're finished running your superuser stuff, make sure to
"exit", or 20 minutes later after you've forgotten you're still root
you'll do something stupid like "rm -rf *" in the / directory. If you
want to use a GUI-based editor (and I don't use Kate or Kwrite, so I'm
unsure how they handle pure text), you'll have to do some magic with the
X authority settings/files; it's much easier instead to use "sudo".

To use "sudo", which allows you to do a single command as superuser,
you'll need to install it ("apt-get install sudo"), then edit
"/etc/sudoers" as root with "visudo" (don't use a normal text editor)
and add your user to the file with the privileges you want to give
yourself. You can essentially duplicate the "root" line, only using your
user's username, which will allow you to do any superuser-type task, on
a per-command basis, or you can read the man page for sudo and limit
your abilities to various tasks, such as only being able to shut down
the machine, or adding users only, or a mix of several tasks, etc.

To use "sudo", just issue a command like "sudo rm -rf /"; you'll be
asked for your user's password, and then it'll execute the command just
as if root had issued it. There's a configurable time-out, so that if
you use "sudo" again within the time-out period (5 minutes by default, I
believe), you won't have to enter the password again, and the time-out
period resets each time you use "sudo".

An advantage of "sudo" is that it handles all the X authority stuff for
you, so that you can run X as a normal user, and then start a GUI app
with "sudo" privileges so that your GUI app runs with root privileges
even though you're running X as a normal user. Another advantage is that
you don't have to remember to "exit" out of your root shell. Another
advantage is that "sudo" operations are logged. Another advantage, as
hinted at above, is that "sudo" is not an all-or-nothing proposition as
is the "su" command. Another advantage is that you don't have to give
out the superuser passwords to your associates to whom you've delegated
administrative tasks. Just use "sudo".

-- 
Kent West
Technology Support
/A/bilene /C/hristian /U/niversity



Reply to: