
次のコマンドを使用して、root として実行するシェル スクリプトがあります。
ssh remotehost 'su - user sh -c "source /home/user/.profile; <command>"'
次のような出力が得られます。
bash: su - user sh -c "source /home/user/.profile; <command>": そのようなファイルまたはディレクトリはありません。
ただし、/home/user/.profile はリモートホストに確実に存在します。何が起こっているのでしょうか? .profile で定義されているパスをインポートする他の方法はありますか?