LoginSignup
26
26

More than 5 years have passed since last update.

chef でファイルのパーミッションを設定するメモ

Posted at

すでにあるファイルを chmod 644 相当にしたい場合の例。
とりあえず実現できているが、もっといい方法があれば知りたい。

default.rb
%w{
  /var/log/messages
  /var/log/cron
}.each do |file|
  execute "#{file} permission" do
    not_if "test `stat -c '%a' #{file}` -eq '644'"
    command "chmod 0644 #{file}"
    user "root"
    group "root"
    action :run
  end
end

ただし CentOS 上でしか試していないので他の OS だと動かないかも。

26
26
3

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