コマンドラインを介してコマンドにパスワードを複数回渡す

コマンドラインを介してコマンドにパスワードを複数回渡す

実行中でUbuntu 18.04実行bash中のコマンドにパスワードを渡したいのですが、一度実行sudoされると、つまりパスワードがコマンドにパイプされ(python3コマンド実行app)、パスワードを2回尋ねます。 :

echo "passphrase" | echo "passphrase" | echo $password | sudo command

しかし、うまくいかないようです。

このコマンドの出力は次のとおりです。

sudo python3 app.py
Enter PEM pass phrase:
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on https://127.0.0.1:443/ (Press CTRL+C to quit)
 * Restarting with stat
Enter PEM pass phrase:
 * Debugger is active!
 * Debugger PIN: 157-564-730
127.0.0.1 - - [30/Jan/2019 18:29:44] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /static/style.css HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /static/vendor/bootstrap/css/bootstrap.css HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /static/css/simple-sidebar.css HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /static/vendor/jquery/jquery.min.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /static/vendor/bootstrap/js/bootstrap.bundle.min.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /favicon.ico HTTP/1.1" 404 -

unixbashスクリプトのコマンドでこれを行う方法を知っている人はいますか?

ベストアンサー1

おすすめ記事