I have a deploy user that has sudo
privledges.
I can't sudo cd
into the directory, but I can list it like:
sudo ls /root
How can I cd
into the folder, or is that not possible?
I have a deploy user that has sudo
privledges.
I can't sudo cd
into the directory, but I can list it like:
sudo ls /root
How can I cd
into the folder, or is that not possible?
It is not possible, because
sudo
runs a single command as root; your shell is still owned by your user.What you can do is to open a new shell as root, by running
sudo -i
orsudo -s
. Fromman sudo
:Either of these will give you a new shell, with root privileges, where you can freely change directory and run new commands as root.
cd
is a shell builtin command . You can't use it directly withsudo
.Use
to get a root shell and then
cd
into the folder you want.If you don't need root privileges anymore use
or Ctrl-D to exit the root shell.