Debug School

Vinay
Vinay

Posted on

Day2 Chef Lab-Rajesh

**Write a recipe to create a file which should be owned by group called “root”, user “ec2-user” and permission executable.**
[root@ip-172-31-5-82 recipes]# cat user.rb
`user 'ec2-user' do
  comment 'A random user'
  uid 1234
  gid 'root'
  password 'password'
end
`
`file '/home/centos/test/vinay.txt' do
  content 'hello world'
  mode '0755'
  owner 'ec2-user'
  group 'root'
end
`
** Write a recipe to updates the access (atime) and file modification (mtime) times for a file.**
`file '/home/centos/test/vinay.txt' do
  action :touch
end
`
**Write a chef recipe to Create a directory**
`directory '/home/centos/test/dir' do
  owner 'ec2-user'
  group 'root'
  mode '0755'
  action :create
end
`



Enter fullscreen mode Exit fullscreen mode

Top comments (0)