Question: In my project, I have to install some package remotely. If I have to login in debian, I say: 

```
$ ssh root@remotehostname
root@remotehostname's password: 

```

it logs in successfully. 

I have login in **ubuntu** in directly using

```
 $ root@remotehostname
 root@remotehostname's password:

```

it is throw error message in

```
Permission denied, please try again.

```

How to solve this problem?

Answer: 
[Ubuntu documentation](https://help.ubuntu.com/community/RootSudo) says:

> 
> **By default, the Root account password is locked in Ubuntu.**
> 
> 
> 

It also says:

> 
> **Please keep in mind, a substantial number of Ubuntu users are new to
>  Linux.** There is a learning curve associated with any OS and many new
>  users try to take shortcuts by enabling the root account, logging in
>  as root, and changing ownership of system files.
> 
> 
> 

It talks at length about why it's been done this way.

---

Enabling the root account:

```
sudo -i

```

To enable the Root account (i.e. set a password) use: 

```
sudo passwd root

```

**Use at your own risk!**

> 
> **Logging in to X as root may cause very serious trouble.** If you believe
>  you need a root account to perform a certain action, **please consult
>  the official support channels first**, to make sure there is not a
>  better alternative.
> 
> 
>
You could set a password for root, but this is not recommended and could open a security risk. But if you have an user account on the target system that has sudo credentials, you could log in as user:

```
ssh user@remotehostname
user@remotehostname's password:

```

and then do what you want using sudo or get a root shell the recommended way:

```
user@remotehostname$ sudo su
Password:
root@remotehostname#

```

and then do your housekeeping. Instead of 'sudo su' you also could use 'sudo -i', which is equivalent, or 'sudo -s', that keeps the current environment.

See [Ubuntu Sudo/Root documentation](https://help.ubuntu.com/community/RootSudo)