12
12

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.

Jenkins でシェルスクリプトの実行ユーザを指定

Posted at

Jenkins でシェルスクリプトを実行する際のユーザは jenkins アカウントですが、
他のユーザで実行したい場合も多々あると思います。
(この場合、jenkins のサーバとシェルスクリプトは同じホストですよね)

ググったら visudo コマンドを使って sudo コマンドを使うというものが多かったのですが、私的には以下の方法を思いついたので紹介まで。

その方法は...

ssh プラグインを使って(リモートホストとして)シェル実行

です。

スミマセン、、、ただそれだけです。

ssh プラグインではユーザ名の指定はもちろんの事、パスワード or キーファイルも選べるので問題なく使えると思います。
alt

これだと jenkins の世界だけで済んでいるのでメンテも楽だと思います。


参考:

Jenkinsでsudoが必要な場合
http://qiita.com/ykirishima/items/2f32dae7fa28a2b45801

Jenkinsでシェルスクリプトを他のユーザとして実行
http://qiita.com/tmtysk/items/37c8c58cd59f834b1939

12
12
0

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
12
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?