LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 02-28-2011, 11:37 PM   #1
noony123
Member
 
Registered: Oct 2010
Posts: 167

Rep: Reputation: 0
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 ?
 
Old 03-01-2011, 01:40 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
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
 
Old 03-01-2011, 02:15 AM   #3
noony123
Member
 
Registered: Oct 2010
Posts: 167

Original Poster
Rep: Reputation: 0
Dear Sir,

I meant is there any way to see which user can access which file ?
 
Old 03-01-2011, 02:19 AM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
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
 
Old 03-01-2011, 03:14 AM   #5
sumeet inani
Member
 
Registered: Oct 2008
Posts: 901
Blog Entries: 26

Rep: Reputation: 49
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
 
Old 03-03-2011, 12:01 AM   #6
sumeet inani
Member
 
Registered: Oct 2008
Posts: 901
Blog Entries: 26

Rep: Reputation: 49
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with user permission level--give access to a user 2 use 500 servers svani Linux - Newbie 2 06-17-2010 08:57 PM
vsftpd read access for user accounts but needs write access ncsuapex Linux - Server 2 04-23-2010 10:51 AM
I lose ftp access when I disable shell access for user captainObvious Linux - General 3 11-13-2004 05:49 PM
grant user access to /fat-c & copying users' preferences to another user n0x Linux - Newbie 1 07-04-2004 12:04 AM
getting access denied , when trying to access camera as normal user bennythepitbull Linux - Hardware 2 11-04-2003 02:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration