change drive

ZIYAD A. M. AL-BATLY zamb at spymac.com
Wed Apr 20 11:13:00 UTC 2005


On Wed, 2005-04-20 at 12:03 +0200, Mario Vukelic wrote:
> I did not catch the whole message, but I ran across a problem with sudo:
> If the permissions of a directory don't allow a normal user to read its
> contents or change into it, the fact that cd (as a shell built-in
> command) is not available with sudo becomes a real problem.
> Case in point: /etc/ppp/peers: there seems to be no way to change
> anything there if you don't have a root user.
> 
> Am I missing something? If not, I would file a bug.
> 
> Kind regards, M
> 
> 
WARNING:
        Despite what I say in this message or what you understand from
        it, you should *NOT* use "sudo -s" ever!  Or, in the rarest
        cases, you should use it as little as possible.  It's a very big
        security risk and negate the purpose "sudo" was created for.

You could always use "sudo -s" which will switch you to the user root
(just as "su" will do if it's available), from that point you do
whatever you want.  However, "sudo" was put (as a substitute for "su")
exactly to prevent this kind of things.

As for the example you mentioned, if you want to do any work on PPP you
should add yourself to the "dip" group, and thus, have access to that
directory (you still have no write permissions, thou).  From there on,
you should use "sudo" to edit/do whatever you want.  However, again, you
should always relay on the tools that is provided to you by the system
you're using.  Always use pppconfig (for normal dial-up) and pppoeconf
(for DSL and cable) connections.

Even if you want to do some manual work on anything in "/etc/ppp/peers"
you could do it without switch to the root user or adding yourself to
the "dip" group.  Here's an example:
        sudo vi /etc/ppp/peers/dsl-provider
The above command will edit that file.  How did I know it's there if I
don't have access to the directory?  Will, when I used pppoeconf to
set-up my DSL connection it asked me what to name it, and it defaults to
"dsl-provider".

I hope this helps you a little.
Ziyad.





More information about the ubuntu-users mailing list