LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Syntax question (http://www.linuxquestions.org/questions/linux-newbie-8/syntax-question-232950/)

satimis 09-20-2004 11:54 AM

Syntax question
 
Hi folks,

What will be the correct syntax to change the ownership and group of dir-A including all its directories and all files.

Example:
owner=AAA
group=BBB

# chown -c AAA BBB /path/to/dir-A

Please advise. TIA

B.R.
satimis

Demonbane 09-20-2004 12:00 PM

use the "-R" option

ppuru 09-20-2004 12:01 PM

SAtmis

chown -R AAA:BBB /path/to/A

satimis 09-20-2004 08:16 PM

Hi ppuru and Demonbane,

Tks for your advice.

Is there any command OR combination of commands which can easily discover the subdirectories and files under dir-A belonging to 'root' and another group, say CCC, instead of checking each directory and file.

Furthermore if a directory/file belonging to 'root' and in the group of user, say xxx, can xxx open it?

TIA

B.R.
satimis

Tinkster 09-20-2004 08:24 PM

No, there is no "centralised permission database" ...

You could use
find
with the -gid and/or -uid expressions to search.


Cheers,
Tink

satimis 09-22-2004 12:17 PM

Hi Tinkster,

Tks for your advice.

Quote:

No, there is no "centralised permission database" ...

You could use
find
with the -gid and/or -uid expressions to search.

Can I use following combination of commands to search them.

find -gid -uid | grep "root:CCC"

B.R.
satimis

Tinkster 09-22-2004 01:43 PM

I was thinking more along the lines
of

find -uid 0 -gid 500

But

find -user CCC -group root
will work as well ...


Cheers,
Tink

satimis 09-22-2004 10:01 PM

Hi Tinkster,

Tks for your advice.

Quote:

find -uid 0 -gid 500
What do '0' and '500' represent?
Quote:

find -user CCC -group root
will work as well ...

Yes. But paths must precede expression

# find /path/to/directory/ -user CCC -group root

NOT

# find -user CCC -group root /path/to/directory/

Tks.

B.R.
satimis

Tinkster 09-22-2004 10:16 PM

I never mentioned a path, did I? :}

If you omit it it will start searching in the
current directory

Thanks for trying to educate me, anyway.


Cheers,
Tink

chrism01 09-23-2004 08:47 AM

All user and group ids/ownerships are actually done by number, see /etc/passwd, /etc/groups.
The names are just there for ease of reading... analogous to using DNS on the net, it's all done by numeric ip addresses in the background, it just looks like the net knows what www.google.com means. :)


All times are GMT -5. The time now is 07:33 AM.