[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 475
  • Last Modified:

how to give password for sudo while doing ssh?

I am trying to do like this

ssh my.hostname.com "sudo /etc/rc.d/apache restart"

and sudo is asking for the password which when I type is clearly visible on the terminal.. what should I do so that password would not be visible when I type my password while executing above command. Thanks!
0
beer9
Asked:
beer9
3 Solutions
 
B HCommented:
in your ssh client program, there is an option for "local echo", do what it takes to disable local echo and you won't see what you type, only the output
0
 
Monis MontherSystem ArchitectCommented:
You can setup sudo to run without a password for your user

username ALL= NOPASSWD: /full/path/to/command

Example

mark  ALL= NOPASSWD: /etc/rc.d/apache restart

Assuming your name is mark
0
 
woolmilkporcCommented:
Hi,

just let ssh allocate a tty, so it can successfully enter "security" mode.

ssh -tt my.hostname.com "sudo /etc/rc.d/apache restart"

From now on your password will be invisible when you type it.

wmp





0
 
beer9Author Commented:
Thank you! :)
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now