LinuxQuestions.org
Review your favorite Linux distribution.
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 09-20-2004, 10:54 AM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,410

Rep: Reputation: 53
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
 
Old 09-20-2004, 11:00 AM   #2
Demonbane
Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
use the "-R" option
 
Old 09-20-2004, 11:01 AM   #3
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 46
SAtmis

chown -R AAA:BBB /path/to/A
 
Old 09-20-2004, 07:16 PM   #4
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,410

Original Poster
Rep: Reputation: 53
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
 
Old 09-20-2004, 07:24 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,974
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
No, there is no "centralised permission database" ...

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


Cheers,
Tink
 
Old 09-22-2004, 11:17 AM   #6
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,410

Original Poster
Rep: Reputation: 53
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
 
Old 09-22-2004, 12:43 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,974
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
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
 
Old 09-22-2004, 09:01 PM   #8
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,410

Original Poster
Rep: Reputation: 53
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
 
Old 09-22-2004, 09:16 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,974
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
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
 
Old 09-23-2004, 07:47 AM   #10
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

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


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
rnc Syntax Question Linux31 Linux - Networking 1 10-07-2005 05:28 AM
Wget - syntax question satimis Linux - Software 3 09-11-2004 03:29 AM
mysql syntax question pk21 Linux - General 1 05-18-2004 06:30 AM
iptables syntax question Poetics Linux - Security 4 12-24-2003 03:32 PM
Syntax question satimis Linux - Newbie 4 10-08-2003 09:33 PM


All times are GMT -5. The time now is 12:19 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration