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.

Richard
  • 879
  • 2
  • 8
  • 19

3 Answers3

1
sudo su - ###gets you to /root, as the root user.
fromnaboo
  • 6,702
  • 2
  • 22
  • 13
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).

phunehehe
  • 20,030
  • 27
  • 99
  • 151
0
sudo su # proper user switch
cd # goes to $HOME by default
lynxlynxlynx
  • 3,313
  • 16
  • 23