LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   User access ! (https://www.linuxquestions.org/questions/linux-newbie-8/user-access-865634/)

noony123 02-28-2011 11:37 PM

User access !
 
Hi all.

This query seems stupid but i thought i shall still ask. If i want to know what access does a particular user has on system, so how can i do that ?

Now this question seems very subjective. User can have read/write/access on many files, so is there any way to filter it, like which files a particular user can read or write or execute ?

corp769 03-01-2011 01:40 AM

Are you talking about file permissions and ownership? You can chmod to whatever you need, and chown for a specific user and group.

Cheers,

Josh

noony123 03-01-2011 02:15 AM

Dear Sir,

I meant is there any way to see which user can access which file ?

corp769 03-01-2011 02:19 AM

Yes, you can use ls -al to list the details of the files you are working with and you can see specifically what user and group owns the file. You can use chmod to remove permissions for the "other" to deny read, write, and execute permissions to other users that do not own the file. Hope that helps,

Josh

sumeet inani 03-01-2011 03:14 AM

CONCEPT
In my home folder if I run 'ls -al'
I get something like this
drwxr-xr-x 57 lxuser lxuser 4096 2011-03-01 13:21 .

type : (d=directory,-=file)
permission : rwx(owner) r-x(group) r-x(others)
57=number of hard links
You can change permission using 'chmod' while ownership can be changed using 'chown'.
r=4,w=2,x=1 so calculate
$chmod 432 test
interpretation : 432 means 4=r for owner , 3=2+1=w+x for group & 1=x for others.
$chown owner:group file
In above example . (current folder) belongs to only lxuser

sumeet inani 03-03-2011 12:01 AM

if you want to find files belonging to each user in particular_folder
Then
Code:

find  particular_folder  -type f  -exec 'ls' '-al' '{}' ';'  | sort -k 3 # replace 'sort -k 3' by 'grep -i username' (without quotes) if you do not want to see all users
This will take time if there are too many files ( eg :- you gave whole file system as input i.e / )

To find files belonging to particular group with specific permission
Code:

find folder_name -group gname -perm number -type f -exec 'ls' '-al' '{}' ';'


All times are GMT -5. The time now is 07:12 PM.