I want to login as root and make the / as the default directory in SFTP. Newbie help needed


1 Answer 1


Warning: This method might be unsafe for server users.

Ubuntu doesn't allow root user and also login in ssh as root by default.

So the first thing you have to do is to enable your root user account:

$ sudo passwd root

Now you have got your root account enabled now.

I am not sure whether you have installed your OpenSSH server or not.

So I will teach you how to install OpenSSH server.

$ sudo apt-get install openssh-server

Now you are able to edit the ssh config:

$ sudo vi /etc/ssh/sshd_config

Find the line contains "PermitRootLogin no", modify it to "PermitRootLogin yes".

Oh yeah, now restart the ssh server:

$ sudo service ssh restart

Now give it a try

  • 1
    Thanks. I edited the /etc/passwd file to change the root's home directory..
    – Nabil
    Jan 6, 2014 at 12:57
  • every road leads to rome,right?
    – z8r0
    Jan 6, 2014 at 13:40
  • 1
    I can confirm this works. but in my opinion, yes it is unsafe Oct 23, 2019 at 7:53

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