You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
System.UnauthorizedAccessException: 'Access to the path is denied.' When Create Publisher #6
Hi
On windows, there is System.UnauthorizedAccessException: 'Access to the path is denied.' if the publisher and subscriber are created by different accounts in different processes.
for example, a windows service process create a subscriber, later, when an user application try to create the publisher, the exception will be thrown. Can we create the memory mapped file that can be accessed by all everyone?
@cbfrank . Same problem here, when running the Main application as Windows Service under LocalSystem Account. The other apps running under a normal account can't access the Queue Semaphore with Access denied error.
I made a patch to Cloudtoid.Interprocess package to make the Named Semaphore accessible to Everyone..
Check the solution here https://github.com/fabalo76/interprocess/tree/WinSemaphoreACLs
As this is an unofficial branch (pending to merge with official branch) and only tested in Windows ,you have to install the package manually in your visual studio.
You could compile it by yourself or try my binary package Cloudtoid.Interprocess.1.0.156.zip
Check the source code for Semaphore/Windows/SemaphoreWindows.cs
@fabalo76 I'm not sure giving the Everyone account full control is the best idea from a security perspective. Ideally, you'd be able to configure it, so you can grant the required access rights only for the actual accounts at either end of the pipe.
Any update? I have the same problem in Linux with semaphore and MemoryFile permissions. Errors:
MemoryFile
System.UnauthorizedAccessException: Access to the path '/tmp/.cloudtoid/interprocess/mmf/test.qu' is denied.
---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at Cloudtoid.Interprocess.Memory.Unix.MemoryFileUnix..ctor(QueueOptions options, ILoggerFactory loggerFactory)
at Cloudtoid.Interprocess.MemoryView..ctor(QueueOptions options, ILoggerFactory loggerFactory)
at Cloudtoid.Interprocess.Queue..ctor(QueueOptions options, ILoggerFactory loggerFactory)
at Cloudtoid.Interprocess.Subscriber..ctor(QueueOptions options, ILoggerFactory loggerFactory)
at Cloudtoid.Interprocess.QueueFactory.CreateSubscriber(QueueOptions options)
Semaphore
Cloudtoid.Interprocess.Semaphore.Posix.PosixSemaphoreUnauthorizedAccessException: The semaphore exists, but the caller does not have permission to open it.
at Cloudtoid.Interprocess.Semaphore.Linux.Interop.CreateOrOpenSemaphore(String name, UInt32 initialCount)
at Cloudtoid.Interprocess.Semaphore.Linux.SemaphoreLinux..ctor(String name, Boolean deleteOnDispose)
at Cloudtoid.Interprocess.InterprocessSemaphore.CreateReleaser(String name)
at Cloudtoid.Interprocess.Publisher..ctor(QueueOptions options, ILoggerFactory loggerFactory)
at Cloudtoid.Interprocess.QueueFactory.CreatePublisher(QueueOptions options)
To reproduce
First create a subscriber in a program with root (Uid: 0) and a publisher like user (Uid; 1000). The MemoryFile and base folder set the permissions by default, the same in case of semaphore
Solution
Set permissions to base folder when I create a subscriber from root but I cannot have control of the semaphore :/ so the Semaphore problem is still happend. I going to try create a pull request with a permission options to fix it
Activity
fabalo76 commentedon Jun 3, 2021
@cbfrank . Same problem here, when running the Main application as Windows Service under LocalSystem Account. The other apps running under a normal account can't access the Queue Semaphore with Access denied error.
I made a patch to Cloudtoid.Interprocess package to make the Named Semaphore accessible to Everyone..
Check the solution here
https://github.com/fabalo76/interprocess/tree/WinSemaphoreACLs
As this is an unofficial branch (pending to merge with official branch) and only tested in Windows ,you have to install the package manually in your visual studio.
You could compile it by yourself or try my binary package
Cloudtoid.Interprocess.1.0.156.zip
Check the source code for Semaphore/Windows/SemaphoreWindows.cs

cocowalla commentedon Jun 3, 2021
@fabalo76 I'm not sure giving the Everyone account full control is the best idea from a security perspective. Ideally, you'd be able to configure it, so you can grant the required access rights only for the actual accounts at either end of the pipe.
prezaei commentedon Jul 11, 2021
Hey folks, any suggestions on the best way to provide a solution here? I'd be happy to implement it.
MacKey-255 commentedon Aug 14, 2025
Any update? I have the same problem in Linux with semaphore and MemoryFile permissions. Errors:
MemoryFile
Semaphore
To reproduce
First create a subscriber in a program with root (Uid: 0) and a publisher like user (Uid; 1000). The MemoryFile and base folder set the permissions by default, the same in case of semaphore
Solution
Set permissions to base folder when I create a subscriber from root but I cannot have control of the semaphore :/ so the Semaphore problem is still happend. I going to try create a pull request with a permission options to fix it