I want to
/var/named but it gives me a permission denied error, and when I want to use
sudo to do this I am not permitted. What is the technical reason for this, and is it possible to do this some other way?
The reason you can't to this is simple and two fold
1: cd is not a program but an in-built command and sudo only applies to programs.
2: If it were possible to use sudo to
This is not possible.
You can use
You are now logged on as root and can use whatever commands you wish. When finished type
It's also worth remembering that,
Why is this important? Because the basic execution flow of sudo becomes something very similar to this:
(This may be technically slightly incorrect; there is a system call which actually replaces the running process with a new one (that's the C library's
This becomes important when you consider that the current working directory is a property of each process and is inherited but not promoted. So if process A spawns off a new process B, then process B starts with the same working directory that process A was in. (This is why something as mundane as
So even if
As @Warren Hill pointed out, the proper solution (I actually wouldn't call it a workaround) is to use
If you run:
your will get:
You can use
To return back to your normal shell simply hit Ctrl+D.