Question: So I have a script that needs to be executed remotely as root. This isn't a problem with most Linux distros since they have a root account. But since Ubuntu does not, executing anything as root requires a 2-step process of entering the account password twice - once to log in and once for sudo. The SSH process to launch the script is automated, so it cannot pause for user input for the second password request.

Does anyone know, short of hacking Ubuntu to re-enable root (not an option), if unattended SSH script execution with superuser privilege on the target machine is possible? Also, having no experience with Debian, does Debian behave this way too?

Answer: 
You can ssh in using key-based only authentication, and then edit the sudoers file not to require a password. This will eliminate the password at the two steps you described.

To see up ssh key based ssh access:

```
ssh-keygen
ssh-copy-id dest-server

```

And the for the sudoers file:

```
sudo visudo -f /etc/sudoers
#uncomment the following and then add yourself to the sudo group
# %sudo ALL=NOPASSWD: ALL

```

Better would be to require no password for sudo only for the commands you need to automate this particular function. See my answer [here](https://serverfault.com/questions/133529/configuring-sudo-to-work-without-password) for that.

References:  

[Setting up a user without a password](https://serverfault.com/questions/292/setting-up-a-user-without-a-password)

[How do you setup ssh to authenticate using keys instead of a username / password?](https://serverfault.com/questions/2429/how-do-you-setup-ssh-to-authenticate-using-keys-instead-of-a-username-password)
> 
> This isn't a problem with most Linux
>  distros since they have a root
>  account. But since Ubuntu does not
> 
> 
> 

Is this a serious sentence? I am yet to see a single \*nix system without `root` account.

```
sudo su

```

and you are root. After that use `passwd` to set root password. And BAM! you are able to login as root (but only if you enable RootLogin in ssh)!

UPDATE: Or use ssh keys as others suggested.