結論
公式ドキュメントを読みましょう。
なお、remote_file
内だけでの話ではなく、Resource Type
内での話です。
user String If you specified this, commands related with the resource will be executed as the user.
つまりどういうことか
以下のように書いた場合、foo
が sudo できないとエラーになります。
remote_file '/path/to/hoge.txt' do source 'hoge.txt' user 'foo' end
やりたかったことは /path/to/hoge.txt
の owner
と group
を foo
にすることです。
そしてこれらのことをするにはきちんと専用のメソッドが用意されていました。
以下のように書けばよいということです。
remote_file '/path/to/hoge.txt' do source 'hoge.txt' owner 'foo' group 'foo' end
補足
なぜ remote_file
内で user
メソッドを用いることで owner
と group
が設定できるかと考えたかと言うと、git
ではそれで OK だったからです*1。
最近*2ハマり過ぎでつらいです。