User Permission check on ioctl command
问题 I am implementing char driver ( Linux) and there are certain IOCTL commands are there in my driver which needs to be only executed by ADMIN. My question is how can I check user permission under my ioctl command implementation and restrict unprivileged user from accessing IOCTL. 回答1: You can use bool capable(int cap) function, which returns true if user has capability requested. Possible values of cap are listed in kernel sources at include/uapi/linux/capability.h (macros started with CAP_ ).