Hi NXP team, I develop a project on i.MX6UltraLite custom board.
There are two programs which are IPC_server and IPC_client.
In order to execute these two programs automatically, I add a script in yocto/sources/meta-freescale-distro/recipes-fsl/fsl-rc-local/fsl-rc-local.
The contents of the script are as follows.
if [ -f /home/root/IPC_server_init ]; then
/home/root/IPC_server_init
else
/home/root/IPC_server &
sleep 12s
/home/AP/IPC_client
fi
I create a normal user who is ap.
IPC_server should be a privilege program, both owner and group of the file are root.
IPC_client should be a normal program, both owner and group of the file are ap.
The device automatically login with root after booting.
When IPC_client process is launched, it runs with the same permission as root that ran it.
It would let IPC_client have superuser permission to execute any command.
For example, IPC_client can kill IPC_server process.
I want root to run IPC_client and allow IPC_client with ap permission to execute limited commands and file access.
How to allow IPC_server has root permission and IPC_client has ap permission when root runs both programs at the same time.
Could anyone give me some suggestions to achieve this requirement.
Solved! Go to Solution.
I have used fork function and exec function to solve this issue.