Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ユーザー x がスクリプトを実行します。ここで、スクリプト内のユーザーをユーザー y に変更します。
#!/bin/sh whoami echo password | su y whoami
しかし、私はこれを取得します:
x su: must be run from a terminal x
ご協力いただきありがとうございます。
これは、bashスクリプト内で機能しています:
whoami; sudo su $user << BASH whoami; BASH
SuはBashスクリプトでは実行できません。sudo -u <user> <command> &&ただし、使用することはできます。
sudo -u <user> <command> &&