Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ?
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,
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
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' '{}' ';'
Last edited by sumeet inani; 03-03-2011 at 12:49 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.