Easiest way to do a remote sudo

Easiest way to do a remote sudo

Let’s see the easiest way to do a remote sudo:

Usually when a sudo command is executed in a remote server, an error is receive telling us that a remote sudo in not possible, even if the user have permissions for the command we want to use.

easiest way to do a remote sudo 01

This is because sudo, by default, requires a tty to be executed, making not possible to execute it.

CollectNode captures the sudo commands and processes them in a way that this requirement is no longer a problem.

easiest way to do a remote sudo 02

With the command configure we can now configure the password to use if the sudo execution requires a password in the remote servers.  If the sudo password is not configured, CollectNode will use the password of the user used to connect to the remote servers.

Now execute remote sudo is easiest than ever  🙂

Get CollectNode now !

Leave CollectNode to make the hard work, and spend your time where really matters.

Execute sudo commands remotely

Execute sudo commands remotely

By default execute remote commands on Unix/Linux systems is as easy as type this code:

But sometimes the result is not the expected:

What is happening here is that sudo by default requires a TTY in order to works, but this behaviour can be changed at /etc/sudoers (use the command visudo for that purpose), changing the line:

by

So now, if we try again, probably we will get the following output:

This is because the user requires a password in order to grant sudo permissions, but we don’t have TTY to type it. The way to fix it is to modified the sudo entry at /etc/sudoers or /etc/sudoers.d/ to allow the user to make sudo without password.

Let’s try now:

Done!


In summary

So, in summary, the steps to follow are:

  1. modified /etc/sudoers  line Defaults requiretty by:

  1. Allow the user to do sudo without password:

That is very useful when we need to get information or execute some command quickly in a server, However from version 1.0.8  CollectNode works with sudo in a very easy way, making not necessary to do all this configuration.

 

Get CollectNode now !

Leave CollectNode to make the hard work, and spend your time where really matters.

Pin It on Pinterest