I use the development board T2080RDB-PC with Yocto QorIQSDK_v2.0. I have created users with restricted privileges using the useradd recipe.
The problem is that for an application that I am developing I need to change the time often. How can these non-root users change the time? I just want these users to be able to change the date but remain users with restricted privileges.
Thanks.
解決済! 解決策の投稿を見る。
Hello Sandra Trujillo García,
Please add "sudo" in the rootfs package list, then modify date with sudo permission on the target board.
You also could use the command "setcap CAP_SYS_TIME+ep /bin/date", please add libcap into rootfs filesystem.
You could refer to permissions - Allow a specific user or group root access without password to /bin/date - Unix & Linu... for details.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Sandra Trujillo García,
Please add "sudo" in the rootfs package list, then modify date with sudo permission on the target board.
You also could use the command "setcap CAP_SYS_TIME+ep /bin/date", please add libcap into rootfs filesystem.
You could refer to permissions - Allow a specific user or group root access without password to /bin/date - Unix & Linu... for details.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I have managed to use the 'date' command without having to be a root user and without the need to enter the root password.
To do this we introduce the following command as root: # sudo visudo
Now the sudoers file will be opened and we will have to add the following line:
## My rules
Cmnd_Alias DATE = / bin / date
% group_name ALL = (root) NOPASSWD: DATE
Where group_name is the name of the group to which we want to give this permission, to know this name type the command 'groups' and the name of the user to whom you want to give permission
I'm trying to use the capabilities (CAP_SYS_TIME) but when I run the "setcap CAP_SYS_TIME + ep / bin / date" command, I get the following error:
Failed to set capabilities on file '/bin/date' (Invalid argument)
usage: setcap [-q] [-v] (-r|-|<caps>) <filename> [ ... (-r|-|<capsN>) <filenameN> ]
Note <filename> must be a regular (non-symlink) file.
Any suggestions?