18
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Capistranoでsudo実行時にttyエラー

Posted at

Capistranoでデプロイ時にsudoを実行させたいときがある。

その時

sudo: sorry,you must have a tty to run sudo.

こんなエラーがでてしまってうまくいかない。

これはtty(端末)を持っていない状態でsudoしてるため。
そんな時は/etc/sudoersを編集。

$sudo visudo
/etc/sudoers
Defaults requiretty

この部分を以下のようにコメントアウト

/etc/sudoers
#Defaults requiretty

もしくは

/etc/sudoers
Defaults !requiretty

しかし特定のユーザーに対して許可することが望ましいので

/etc/sudoers
Defaults:'対象のユーザID' !requiretty
18
19
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?