cause permission denied while execute golang syscall.MProtect - go

When I use package syscall like this:
err := syscall.Mprotect(page, syscall.PROT_READ|syscall.PROT_WRITE|syscall.PROT_EXEC)
error occurs as below
permission denied
It seems EACCES error in C. What should I do?

Related

Go win64 api permission denied

I am using this Windows API wrapper to try and get bitlocker status.
My code is:
test, err := wapi.GetBitLockerConversionStatus()
I am getting the following error:
err wmi.Connect: permission denied: Exception occurred. (Access denied )
When I'm logged with the same user I can get results with C# code:
IShellProperty prop = ShellObject.FromParsingName("C:").Properties.GetProperty("System.Volume.BitLockerProtection");
I have tried to call other functions in the Go wrapper such as wapi.ProcessList() and it works, so the permission issue seems to be specific to the BitLocker function and not the whole package or anything else.
My question is why does it require special permission in Go but not in C# and is there a way to get that information without elevated permission?

How to resolve permission denied # rb_sysopen

I am writing a simple recipe to create file like:
file '/myfile' do
content 'Welcome to Technical Guftgu'
action :create
end
but on chef-client -zr "recipe[test::recipe1]"
i am getting 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
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
Errno::EACCES Means "Permission Denied"
The Errno class is mapped to your system call errors at runtime. You can find this (confusingly) documented in:
SystemCallError#errno
Errno
In particular:
Errno.constants.include? :EACCES
#=> true
on most *nix sytems Errno::EACCES maps to the libc error code for "permission denied". Specifically:
Macro: int EACCES
"Permission denied." The file permissions do not allow the attempted operation.
That generally means your #create action doesn't have permissions to read, write, or traverse the path to the file you are trying to manage, so you need to change your implementation (which you don't show in your original post) to ensure that your Ruby process has the needed file or filesystem permissions to perform the requested operations.
See Also
Understanding Ruby's strange "Errno" exceptions
errno Lookup
errno.h from The Open Group Base Specifications Issue 7, 2018 edition

composer-playground EACCES error when lauching

When I'm trying to start composer-playground from ubuntu I got the error:
$ composer-playground info: [Hyperledger-Composer] :LoadModule
:loadModule() Loading composer-wallet-filesystem from
/home/rui.oliveira/.nvm/versions/node/v8.11.3/lib/node_modules/composer-playground/node_modules/composer-wallet-filesystem
info: [Hyperledger-Composer] :PlaygroundAPI :createServer()
Playground API started on port 8080 events.js:183
throw er; // Unhandled 'error' event
^
Error: EACCES: permission denied, open '/home/...log'
When I go to the log file the only entry I've got is:
2018-09-21T20:38:52.508Z ERROR :HLFConnectionManager
:fabric-client() [ChannelEventHub.js]: _connect - timed out
after:300000 {}$
My current log level is: composer[debug]:*
I'm using REST Server with oauth and multi-user and I can do GET or POST with success (HTTP200) but when I do a POST transaction nothing is set to the peers.
Can someone help trying to debug this?
EACCES is permission denied but not sure what is really being denied here...
Thanks in advance.

Laravel5 cashier downloadInvoice() permission denied error

Unable to download pdf generated with laravel 5 cashier and phantomjs. Throws following error:
ProcessFailedException in Process.php line 233: The command "/PROJECT/vendor/laravel/cashier/src/Laravel/Cashier/bin/linux-x86_64/phantomjs invoice.js /PROJECT/storage/framework/48dc273eaff3a0adaab8aa4f5b1d73df.pdf" failed.
Exit Code: 126(Invoked command cannot execute)
Output:
================
Error Output:
================
sh: 1: /PROJECT/vendor/laravel/cashier/src/Laravel/Cashier/bin/linux-x86_64/phantomjs: Permission denied
I checked storage/framework/ directory pdf has been created with permission 644 and www-data. My storage directory has 777 permission and user say xproject
Can anyone help me to get rid of this error?
I had exactly the same error and after much searching I found this post https://alfrednutile.info/posts/149 by Alfred Nutile
You solve the issue by adding execute permissions to the bin folder recursively:
chmod -R +x vendor/laravel/cashier/src/Laravel/Cashier/bin

Ruby - File.rename() Permission Denied

On Ruby Im trying to fill a temporary file then rename it but getting permission errors on Windows.
File.rename("tempFile.csv", #data_file)
Error
Permission denied - tempFile.csv (Errno::EACCES)
Try to place
File.chmod(0755, "tempFile.csv") rescue nil
before
File.rename("tempFile.csv", #data_file)

Resources