[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <78aa970c1001020516m3d2255fj38f02629e7d740c8@mail.gmail.com>
Date: Sat, 2 Jan 2010 21:16:42 +0800
From: Kevin Qu <rofail@...il.com>
To: dhowells@...hat.com, linux-kernel@...r.kernel.org
Subject: how to get right euid?
I wrote a kernel module and it create a "file" in /proc.
The "file" permission is set to 644.
When check access permission, I use :
if( op == 4 || (op ==2 && current->euid == 0) )
return 0;
But it does not work on 2.6.29,
so I changed it like below:
if( op & 0x4 || (op & 0x2 && current_euid() == 0) )
return 0;
It works when read from the "file" in /proc,
but when write to it with sudo, like:
sudo echo "some thing" > /proc/my_file
It denied. (But it works when I su to superuser and do so.)
So I checked the current_euid(),
but it returns 1000 (not 0),Why?
Thanks for help.
Rofail Qu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists