I have 2 programs that communicate through shared memory that work fine
when I have root privileges, but fail when I sign on as a user. The
server program that creates the shared memory set read an write
permissions to allow everyone to access this memory (rw-rw-rw-).
ShmID = shmget(ShmKEY, sizeof(struct Memory), IPC_CREAT | 0666);
Likewise, the client program, which is started after the server, creates
the shared memory with rw-rw-rw- permissions.
ShmID = shmget(ShmKEY, sizeof(struct Memory), 0666);
But, when I run the client program without root privileges,shmget()
returns -1 and errno = 2 which supposedly means "File/Directory not found".
Why is the client capable of accessing shared memory when executed by
root and not able to, when executed by a user?
I should mention that both the server and client executables have been
chmoded to 777.