Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-22-2004, 02:51 PM
|
#1
|
Member
Registered: Jan 2004
Distribution: CentOS
Posts: 281
Rep:
|
Why can't users chgrp ?
I've asked this question before, although not on this site yet, and I never got a response I understood.
Why is it that an pretty much every unix/linux platform, by default, users cannot chgrp ?
If my users own a file why I can't they decide who else he wants to share it with? Why do they have to come bug me for that?
And while I'm posting- how do I set chgrp to work for everyone? It's already set to 755, but when a user tries to chgrp a file he owns it says
chgrp: changing group of `index.html': Operation not permitted
(edit added: Mandrake 9.2)
Last edited by Rotwang; 03-22-2004 at 02:54 PM.
|
|
|
03-22-2004, 03:29 PM
|
#2
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Whos says they can't? They only need to be member
of the target group as well ...
And to me it seems quite logical that one shouldn't
be allowed to change ownership of something to someone/
something one has no control over...
If I were able to chgrp <someotherusersgroup> <file> I
couldn't get that file back ... the only way to get rid of
the other persons rights would be to delete the file (copy
to another place, delete the original, copy it back).
Cheers,
Tink
|
|
|
03-22-2004, 03:33 PM
|
#3
|
Member
Registered: Mar 2004
Location: US
Distribution: Redhat 9 - Linux 2.6.3
Posts: 836
Rep:
|
not only that but if you wrote an exploit of some kind whatever it may be, that exploit if it wre to fork child processes, that parent/child could masquerade in someones group that wouldnt be good.
|
|
|
03-22-2004, 04:05 PM
|
#4
|
Member
Registered: Jan 2004
Distribution: CentOS
Posts: 281
Original Poster
Rep:
|
Quote:
Originally posted by Tinkster
Whos says they can't? They only need to be member
of the target group as well ...
Cheers,
Tink
|
that was it, thanks.
Hey one more thng, is there a line command to display a user? I read the man page on usermod but it doesnt have something like a "display" flag. Do I have to just read /etc/passwd itself and figure out the colons, etc?
|
|
|
03-22-2004, 04:32 PM
|
#5
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Quote:
Originally posted by Rotwang
that was it, thanks.
|
Pleasure :}
Quote:
Hey one more thng, is there a line command to display a user? I read the man page on usermod but it doesnt have something like a "display" flag. Do I have to just read /etc/passwd itself and figure out the colons, etc?
|
What do you mean by "display a user"?
Please re-phrase in a way that a poor, tech-savy
person can comprehend ...
Cheers,
Tink
|
|
|
03-22-2004, 04:54 PM
|
#6
|
Member
Registered: Jan 2004
Distribution: CentOS
Posts: 281
Original Poster
Rep:
|
Quote:
Originally posted by Tinkster
What do you mean by "display a user"?
Please re-phrase in a way that a poor, tech-savy
person can comprehend ...
Cheers,
Tink
|
I meant in the context of adduser, usermod, userdel.
So, like:
login: rotwang
innitial group: idiots
groups: newbies, mshaters
home: /home/morons/rotwang
|
|
|
03-22-2004, 05:28 PM
|
#7
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
oic
No, I don't think there's a tool for that purpose
in the shadow suite, you'll have to learn to
read /etc/passwd :) and /etc/group
Cheers,
Tink
|
|
|
03-22-2004, 05:33 PM
|
#8
|
Member
Registered: Jan 2004
Distribution: CentOS
Posts: 281
Original Poster
Rep:
|
grumble grumble
|
|
|
03-22-2004, 07:52 PM
|
#9
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
:P
Quote:
save as /usr/bin/userinfo
Code:
#!/bin/bash
usage()
{
echo "userinfo <name>"
exit 1
}
if [ "$1" == "" ]; then
usage
fi
line=`grep $1 /etc/passwd`
if [ "$line" != "" ]; then
echo $line | awk -F":" '{print "username: " $1}'
export the_name=$1
echo $line | awk -F":" '{print "userid: " $3}'
echo $line | awk -F":" '{print "description: " $5}'
echo $line | awk -F":" '{print "home: " $6}'
echo $line |awk -F":" '{print "default shell: " $7}'
export def_grp=`echo $line |awk -F":" '{print $4}'`
fi
echo `awk -F":" '$3~ENVIRON["def_grp"] {print "default group: " $1}' /etc/group`
echo "Other groups:"
grep $the_name /etc/group | awk -F: '{print $1}'
|
Cheers,
Tink
|
|
|
03-22-2004, 09:02 PM
|
#10
|
Member
Registered: Jan 2004
Distribution: CentOS
Posts: 281
Original Poster
Rep:
|
Quote:
Originally posted by Tinkster
:P
Cheers,
Tink
|
Thanks man, it works well. Now see, why don't they make that standard, that wasn't so hard!
Also- there was a /usr/bin/userinfo in there already, and when I try to run it, it says
(userinfo:10326): Gtk-WARNING **: cannot open display:
which means it's an x only app right?
|
|
|
03-22-2004, 09:06 PM
|
#11
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Quote:
Originally posted by Rotwang
Thanks man, it works well. Now see, why don't they make that standard, that wasn't so hard!
|
lol, no it wasn't :)
As a matter of fact, you could have done that, too ;0
Quote:
Also- there was a /usr/bin/userinfo in there already, and when I try to run it, it says
(userinfo:10326): Gtk-WARNING **: cannot open display:
which means it's an x only app right?
|
Yep, presumably gnome related, too ... nothing by
that name on my machine ;) ...
[edit]
I just saw that I made an ugly mistake :}
Code:
#!/bin/bash
usage()
{
echo "userinfo <name>"
exit 1
}
if [ "$1" == "" ]; then
usage
fi
line=`grep $1 /etc/passwd`
if [ "$line" != "" ]; then
echo $line | awk -F":" '{print "username: " $1}'
export the_name=$1
echo $line | awk -F":" '{print "userid: " $3}'
echo $line | awk -F":" '{print "description: " $5}'
echo $line | awk -F":" '{print "home: " $6}'
echo $line |awk -F":" '{print "default shell: " $7}'
export def_grp=`echo $line |awk -F":" '{print $4}'`
echo `awk -F":" '$3~ENVIRON["def_grp"] {print "default group: " $1}' /etc/group`
echo "Other groups:"
grep $the_name /etc/group | awk -F: '{print $1}'
fi
That's better :}
[/edit]
Cheers,
Tink
Last edited by Tinkster; 03-22-2004 at 09:11 PM.
|
|
|
03-22-2004, 09:35 PM
|
#12
|
Member
Registered: Jan 2004
Distribution: CentOS
Posts: 281
Original Poster
Rep:
|
Quote:
Originally posted by Tinkster
lol, no it wasn't 
As a matter of fact, you could have done that, too ;0
|
Yea but if I did it, it'd be written in perl.  and it would have bugs.
|
|
|
All times are GMT -5. The time now is 02:02 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|