change drive
James Wilkinson
ubuntu at westexe.demon.co.uk
Wed Apr 20 16:45:58 UTC 2005
ZIYAD A. M. AL-BATLY wrote:
> 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".
You *can* still use sudo on ls to find out what's in a directory. For
example,
james at kendrick:~$ ls -l /proc/1/fd
ls: /proc/1/fd: Permission denied
james at kendrick:~$ sudo ls -l /proc/1/fd
total 1
lrwx------ 1 root root 64 2005-04-20 16:13 10 -> /dev/initctl
(Example chosen because it pretty well *has* to work on any Linux
system.)
You could look at it like this: cd changes the current directory and
leaves it there. sudo just does the command and then drops all
privileges. So if "sudo cd" worked, it would leave your shell somewhere
it had no right to be.
If you really want to be pedantic, a construction like
sudo sh -c 'cd /proc/1/fd && ls -l '
will carry out a series of commanads as root, then drop you back to your
shell with your normal privileges.
Personally, I just sudo su - because I'm lazy and used to it...
James.
--
E-mail address: james | "Bill Gates' School Report":
@westexe.demon.co.uk | Every time you ask him to do something, he breaks down,
| starts again, freezes, and then starts again.
| -- "I'm Sorry, I Haven't A Clue", BBC Radio 4
More information about the ubuntu-users
mailing list