2

I tried jake together with launch a little but when I want to deploy my node.js app I get this during the process:

$ ssh mydomain.com sudo stop site.WebApp-production && sudo start site.WebApp-production
sudo: no tty present and no askpass program specified

✘  Failed to restart site

jake aborted.
Error
  at fail (/usr/local/lib/node_modules/jake/lib/api.js:235:13)
  at /Users/udo/Projects/WebApp/Jakefile.coffee:31:16
  at ChildProcess.exports.remote (/Users/udo/Projects/WebApp/node_modules/launch/lib/action.js:39:5)
  at ChildProcess.EventEmitter.emit (events.js:91:17)
  at Process._handle.onexit (child_process.js:674:10)

Do you know how to get rid of this? I'm using Debian 6 on my remote machine.

Thanks

optikfluffel
  • 2,538
  • 4
  • 20
  • 27

2 Answers2

3

Try ssh -t, which forces TTY allocation when running a command. That's good enough for sudo, at least on my Mac when trying to SSH commands into my Ubuntu boxen.

Garth Kidd
  • 7,264
  • 5
  • 35
  • 36
0

ssh <host> <command> tries to run the command on the host without any interaction. In your case, sudo needs a password, which it can't get because it is not an interactive session. If you really want this, configure sudo to accept you without asking for a password.

Edit: also, ssh <host> <command1> && <command2> will run command2 on the local machine, not on the remote machine.

Sjoerd
  • 74,049
  • 16
  • 131
  • 175
  • is there a way to start a service from /etc/init.d/ without being root or use sudo? maybe only for this special user? i really don't want any user to allow using sudo without asking for the password.. – optikfluffel Aug 01 '12 at 01:32
  • you can allow a given user to use a given command as a given other user with password-less sudo (read: you don't have to give password-less sudo to everybody; you can even restrict the one user that is allowed to sudo without password in what they can do); this still has some security implications (e.g. that user might gain full root-priviliges), but afaict they can do that right now with "sudo bash" as well (though they have to provide their password) – umläute Aug 01 '12 at 16:59