Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve permission denied @ rb_sysopen

I am writing a simple recipe to create a file:

file '/myfile' do
  content 'Welcome to Technical Guftgu'
  action :create
end

But on chef-client -zr "recipe[test::recipe1]" I am getting the the following error:

[2022-03-08T10:54:16+00:00] ERROR: Running exception handlers
Running handlers complete
[2022-03-08T10:54:16+00:00] ERROR: Exception handlers complete
Chef Infra Client failed. 0 resources updated in 02 seconds
[2022-03-08T10:54:16+00:00] FATAL: Stacktrace dumped to /home/vagrant/.chef/local-mode-cache/cache/chef-stacktrace.out
[2022-03-08T10:54:16+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2022-03-08T10:54:16+00:00] FATAL: Errno::EACCES: file[/myfile] (test::recipe1 line 7) had an error: Errno::EACCES: Permission denied @ rb_sysopen - /myfile
like image 270
Sameer kumar Avatar asked Oct 31 '25 12:10

Sameer kumar


1 Answers

It seems that your app does not have access to the file /myfile.

Try this, to allow access to all: sudo chmod a+rw /myfile

like image 111
Moussa Avatar answered Nov 03 '25 15:11

Moussa