8

I have set up my root password but when I try and cd to root dir I get:

bash: cd: root: Permission denied

the exact command is:

cd root

sorry I was unclear but the issue is resolved now thanks a lot everyone.=D

7
  • 3
    You forgot to post the actual command. Looks like there is a mistake there. – mikewhatever Jul 24 '14 at 20:40
  • 2
    Why did you set a root password ? use sudo -i See help.ubuntu.com/community/RootSudo / Also it is likely cd /root – Panther Jul 24 '14 at 20:43
  • did you use "cd root /path/? if you did you should use "sudo cd /path/ – sbergeron Jul 24 '14 at 20:44
  • @sbergeron that won't work because cd is a shell built-in – steeldriver Jul 24 '14 at 22:07
  • What is the exact command? – Braiam Jul 24 '14 at 22:43
19

The best thing to do is sudo su or su, then cd to /root. You can (if you want) string together commands like this: su -c "cd /root; dostuff", but the first way is easier if you need to get into /root.

3
  • 1
    just make sure to type exit in the shell right after you do that, as it is then completely root and any further commands could REALLY mess up your system – sbergeron Jul 24 '14 at 23:43
  • I am getting following error : " su: must be run from a terminal" – Harsha Biyani Jul 8 '16 at 10:11
  • @HarshaBiyani Create a new question with your situation and problem. This question is 2 years old. – Zzzach... Jul 8 '16 at 15:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.