0

I want to access root user's home directory /root/. However following commands dont lead me to the root directory.

sudo -s

cd ~

It leads to the home dir of regular user. How to access /root when using sudo -s to login as root. I am using bash4 on ubuntu12.04.

1
1
sudo su - ###gets you to /root, as the root user.
1

Simply use cd /root if you just want to go there :)

sudo -s may not update all environment variables so some aspects of your shell is still the old one. You can use sudo -i, or one of the methods described in How do I run a command as the system administrator (root).

0
sudo su # proper user switch
cd # goes to $HOME by default

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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