Re: Determining real user access permissions to files/directories (ls -l doesn't help)



Yanko <yhdezalvarez@xxxxxxxxx> wrote:
How can I determine (recursive) which files/ folders inside a folder
are inaccessible for a specific user in a certain way?

Examples of that query would be:
? a list of files that user "exampleuser" can't write inside folder /
var/directory
? a list of files that user "test" can't read inside folder /etc

"ls -l" only helps me if the user is the owner, but it doesn't if the
user belongs to the group owning the file/folder or if the rest of the
users have access to the file/folder.

Is there any command/script which can help me to get such an answer?

You should first determine the groups a user belongs to, and then you can
build a query for the "find" command that would give you the list of files
that meet your criteria. Here is an example:

Let's say you want to know which files and directories within the directory
/some/dir are writable by a user named "testuser". First you determine the
groups this user belongs to using the "groups" command:

$ groups testuser
users staff

Now you can invoke the "find" command as follows:

$ find /some/dir -user testuser -perm -u+w \
-o \( -group users -o -group staff \) -perm -g+w \
-o -perm -o+w

You can combine these two commands into a small script:

DIR="/some/dir"
USR=testuser
MOD=w

find "$DIR" -user $USR -perm -u+$MOD \
-o \( `groups $USR | sed 's/ / -o -group /g;s/^/-group /'` \) \
-perm -g+$MOD -o -perm -o+$MOD

--
Kenan Kalajdzic
.



Relevant Pages

  • Re: Multiple table in dataset query
    ... If a row is marked as Modified, it will run your query defined in the ... Update Command object. ... Dim UpdateStaffCmd As New OleDb.OleDbCommand ... Private Sub frmStaff_Load(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Complex form popup problem: warning...longwinded
    ... command button that launched the other form. ... main form that allows the user to fill out the scenario information, ... The majority of the fields in the query that are the recordsource of the ... remainder belong to the new record that was programmatically saved. ...
    (microsoft.public.access.formscoding)
  • RE: ODBC query in VB code Need HELP
    ... The vb part could be to set up a query string by concatenation or to go ... or call when you press your command button ... the connection string, cursor location, etc. ...
    (microsoft.public.access.formscoding)
  • Re: Query Only Creent Record?
    ... Memos Active, Orders Active, Memos Completed and Orders Completed. ... I tried to build a form called Current Form and a report called Current ... then have the command button on the Current Form to E-mail just that form ... > I would approach this by building a query that refers to that form's ...
    (microsoft.public.access.queries)
  • RE: How to execute a select statement inside an Event Procedure?
    ... I am trying to execute the follow command inside the control source property: ... The NonCompliance is a query-field that I request the information. ... The Month-Process-Compliance-2 is a query. ...
    (microsoft.public.access.formscoding)