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 05-27-2010, 05:34 PM   #1
someshpr
Member
 
Registered: Jul 2009
Location: WI, USA
Distribution: Debian 8, Ubuntu 16.04, CentOS 7
Posts: 141

Rep: Reputation: 28
chown and chgrp: ownership for all members of the group


Hi,
i have quick question. Can I assign ownership of a particular file to everybody of a group?
Is something like
Code:
chown nobody:local-group file
valid? If the file had rwxrw-r-- permissions, will every member of the local-group have owner access privileges (rwx) to this flie now?

TIA,
 
Old 05-27-2010, 05:44 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by someshpr View Post
Hi,
i have quick question. Can I assign ownership of a particular file to everybody of a group?
Is something like
Code:
chown nobody:local-group file
valid? If the file had rwxrw-r-- permissions, will every member of the local-group have owner access privileges (rwx) to this flie now?

TIA,
Yes and yes. You may have to make sure that the directory
the file resides in has the group ownership and the access
set to rx as well.



Cheers,
Tink
 
1 members found this post helpful.
Old 05-27-2010, 08:09 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
I had to disagree with you (especially a Mod!), but the group perms on the file are rw- and he's asking if the chown cmd shown will give the owners perms (rwx !) to the group on the file.
It won't AFAIK. If he wants the group members to have rwx he either needs to change the group perms (chmod) on the file or resort to ACLs.
Of course I could be wrong
 
1 members found this post helpful.
Old 05-27-2010, 08:13 PM   #4
someshpr
Member
 
Registered: Jul 2009
Location: WI, USA
Distribution: Debian 8, Ubuntu 16.04, CentOS 7
Posts: 141

Original Poster
Rep: Reputation: 28
Thanks Tink and Chris!

Last edited by someshpr; 05-27-2010 at 09:38 PM. Reason: Didn't notice the reply #3
 
Old 05-27-2010, 08:13 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by chrism01 View Post
I had to disagree with you (especially a Mod!), but the group perms on the file are rw- and he's asking if the chown cmd shown will give the owners perms (rwx !) to the group on the file.
It won't AFAIK. If he wants the group members to have rwx he either needs to change the group perms (chmod) on the file or resort to ACLs.
Of course I could be wrong
Well spotted; unlike my preferred OS i *suck* at multi tasking ;D


Cheers,
Tink
 
Old 05-27-2010, 09:38 PM   #6
someshpr
Member
 
Registered: Jul 2009
Location: WI, USA
Distribution: Debian 8, Ubuntu 16.04, CentOS 7
Posts: 141

Original Poster
Rep: Reputation: 28
That leads to more questions!

Quote:
Originally Posted by chrism01 View Post
I had to disagree with you (especially a Mod!), but the group perms on the file are rw- and he's asking if the chown cmd shown will give the owners perms (rwx !) to the group on the file.
It won't AFAIK. If he wants the group members to have rwx he either needs to change the group perms (chmod) on the file or resort to ACLs.
Of course I could be wrong
Does that mean there is no way a file can be owned by the whole group (i.e., every member of the group, instead of just only a single member)?

I understand that I can use chmod on the file to replicate the owner perms to group, but that is not same as making every member of the group to be the owner of the file.
Now this leads to three more questions:
1. Does the owner have some more privileges than other members of the group even if the group and the owner has same perms (say, rwxrwxr--)?
2. After chown nobody:local-group file command who has the ownership of the file?
3. If I have to reassign perms to a bunch of files with different perms in a way that all the member of the group has same perms as of the owner, I'll have to do each file individually either manually or via a script. Is that correct?

TIA,
 
Old 05-27-2010, 10:15 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by someshpr View Post
Does that mean there is no way a file can be owned by the whole group (i.e., every member of the group, instead of just only a single member)?

All chris was saying is that the perms on the files will
stay rw, and group owners won't be automatically able
to execute them just because they have group ownership.

Quote:
I understand that I can use chmod on the file to replicate the owner perms to group, but that is not same as making every member of the group to be the owner of the file.
Now this leads to three more questions:
1. Does the owner have some more privileges than other members of the group even if the group and the owner has same perms (say, rwxrwxr--)?
No.

Quote:
2. After chown nobody:local-group file command who has the ownership of the file?
user nobody, and local-group

Quote:
3. If I have to reassign perms to a bunch of files with different perms in a way that all the member of the group has same perms as of the owner, I'll have to do each file individually either manually or via a script. Is that correct?
Not sure I follow ... what's the task at hand?


Cheers,
Tink

Last edited by Tinkster; 05-27-2010 at 11:56 PM.
 
Old 05-27-2010, 11:06 PM   #8
someshpr
Member
 
Registered: Jul 2009
Location: WI, USA
Distribution: Debian 8, Ubuntu 16.04, CentOS 7
Posts: 141

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by Tinkster View Post
Not sure I follow ... what's the task at hand?
Say I have a directory
Code:
user1@creativision:~/Desktop/LQ$ ll
total 0
-rwxr-xr-- 1 user1 softuser 0 2010-05-27 22:18 file1
-rw-rw-rw- 1 user1 softuser 0 2010-05-27 22:18 file2
-rw-r--r-- 1 user1 softuser 0 2010-05-27 22:18 file3
-rw-r--r-- 1 user1 softuser 0 2010-05-27 22:18 file4
-rw-r--r-- 1 user1 softuser 0 2010-05-27 22:18 file5
and the group softuser has three users (user1, user2 and user3).
I want for all the files all the users (user1, user2 and user3) to have same perms as the owner of the files (user1). From what I understand now, since all the files do not have same perms, I believe I'll have to do chmod each file individually (or write a script to process each file individually). So after that it will look like:
Code:
user1@creativision:~/Desktop/LQ$ ll
total 0
-rwxrwxr-- 1 user1 softuser 0 2010-05-27 22:18 file1
-rw-rw-rw- 1 user1 softuser 0 2010-05-27 22:18 file2
-rw-rw-r-- 1 user1 softuser 0 2010-05-27 22:18 file3
-rw-rw-r-- 1 user1 softuser 0 2010-05-27 22:18 file4
-rw-rw-r-- 1 user1 softuser 0 2010-05-27 22:18 file5
I was hoping that if there was a workaround for that (just being lazy ). So I hoped that if I do a
Code:
chown nobody:softuser *
may be in a single stroke of luck all the users (user1, user2 and user3) will effectively have same perms for these files (without changing group perms for the files). In a word, I wish that if there were a command that will make the perms like:
Code:
user1@creativision:~/Desktop/LQ$ ll
total 0
-rwxr-xr-- 1   *   softuser 0 2010-05-27 22:18 file1
-rw-rw-rw- 1   *   softuser 0 2010-05-27 22:18 file2
-rw-r--r-- 1   *   softuser 0 2010-05-27 22:18 file3
-rw-r--r-- 1   *   softuser 0 2010-05-27 22:18 file4
-rw-r--r-- 1   *   softuser 0 2010-05-27 22:18 file5
where * is the wildcard!

Did I make you more confused?


Quote:
Originally Posted by Tinkster View Post
user nobody, and local-group
Who is this nobody?

TIA,
 
Old 05-27-2010, 11:55 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by someshpr View Post
Say I have a directory
Code:
user1@creativision:~/Desktop/LQ$ ll
total 0
-rwxr-xr-- 1 user1 softuser 0 2010-05-27 22:18 file1
-rw-rw-rw- 1 user1 softuser 0 2010-05-27 22:18 file2
-rw-r--r-- 1 user1 softuser 0 2010-05-27 22:18 file3
-rw-r--r-- 1 user1 softuser 0 2010-05-27 22:18 file4
-rw-r--r-- 1 user1 softuser 0 2010-05-27 22:18 file5
and the group softuser has three users (user1, user2 and user3).
I want for all the files all the users (user1, user2 and user3) to have same perms as the owner of the files (user1). From what I understand now, since all the files do not have same perms, I believe I'll have to do chmod each file individually (or write a script to process each file individually). So after that it will look like:
Code:
user1@creativision:~/Desktop/LQ$ ll
total 0
-rwxrwxr-- 1 user1 softuser 0 2010-05-27 22:18 file1
-rw-rw-rw- 1 user1 softuser 0 2010-05-27 22:18 file2
-rw-rw-r-- 1 user1 softuser 0 2010-05-27 22:18 file3
-rw-rw-r-- 1 user1 softuser 0 2010-05-27 22:18 file4
-rw-rw-r-- 1 user1 softuser 0 2010-05-27 22:18 file5
I was hoping that if there was a workaround for that (just being lazy ). So I hoped that if I do a
Code:
chown nobody:softuser *
may be in a single stroke of luck all the users (user1, user2 and user3) will effectively have same perms for these files (without changing group perms for the files). In a word, I wish that if there were a command that will make the perms like:
Code:
user1@creativision:~/Desktop/LQ$ ll
total 0
-rwxr-xr-- 1   *   softuser 0 2010-05-27 22:18 file1
-rw-rw-rw- 1   *   softuser 0 2010-05-27 22:18 file2
-rw-r--r-- 1   *   softuser 0 2010-05-27 22:18 file3
-rw-r--r-- 1   *   softuser 0 2010-05-27 22:18 file4
-rw-r--r-- 1   *   softuser 0 2010-05-27 22:18 file5
where * is the wildcard!

Did I make you more confused?
Actually no, you didn't. That's quite clear. And sorry,
no, changing ownerships leaves perms untouched. You'll
either need to find a tool that does exactly what you
want, or write a script to do what you want.

Quote:
Who is this nobody?

TIA,
A generic system account (and often a group, too). Depending
on the distro you're using it may e.g., be running your
httpd, or some other tasks that are too risky to be run
w/ root privileges.


Cheers,
Tink
 
1 members found this post helpful.
  


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
chmod/chgrp/chown etc. tigertim71 Linux - Newbie 7 06-14-2009 09:48 AM
Cannot chown or chgrp or chanything trashbird1240 Slackware 4 01-15-2007 12:01 PM
chmod ,chown ,chgrp------------ pal Linux - Newbie 1 02-27-2005 03:49 PM
chown, chgrp Help Icarus1701 Linux - Newbie 1 10-25-2004 07:42 PM
problems with chown and chgrp apax Linux - Software 6 11-03-2003 04:44 PM

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

All times are GMT -5. The time now is 01:20 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