[[+content_image]]
A
A
Andrey San2015-11-25 10:23:28
linux
Andrey San, 2015-11-25 10:23:28

Chown, chgrp - how to fix the problem?

Good afternoon, such a problem, I can not understand why this is happening?
first terminal
[[email protected] ~]$ touch file1
[[email protected] ~]$ ls -l
total 0
-rw-rw-r--. 1 user2 user2 0 Nov 25 02:14 file1
[[email protected] ~]$ chgrp user3 file1
chgrp: changing group of `file1': Operation not permitted
[[email protected] ~]$ chown user3 file1
chown: changing ownership of `file1': Operation not permitted
[[email protected] ~]$ ls -l file1
-rw-rw-r--. 1 user2 user2 0 Nov 25 02:14 file1
[[email protected] ~]$
and on the second terminal:
[[email protected] ~]$ touch file2
[[email protected] ~]$ ls -l file2
-rw-rw-r--. 1 user3 user3 0 Nov 25 02:15 file2
[[email protected] ~]$ chgrp user2 file2
[[email protected] ~]$ chown user2 file2
chown: changing ownership of `file2': Operation not permitted
[[email protected] ~]$ ls -l file2
-rw-rw-r--. 1 user3 user2 0 Nov 25 02:15 file2
1. I can't understand why one can change the group of a file and the other does not?
2. for some reason, chown stopped working, being the owner cannot give the file to another

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
J
jcmvbkbc, 2015-11-25
@jcmvbkbc

I can’t understand why one gets to change the group of a file and the other doesn’t?

An ordinary user can only change the group of a file he owns to one of the groups he belongs to. user3 is a member of user2 group? And vice versa?
A normal user cannot change the owner of a file, even for files he owns.
All this and much more can be found in man 2 chown

S
Swartalf, 2015-11-25
@Swartalf

Comparison of the rights to the chown, chgrp binaries on both servers, there is a suspicion that SUIDs can be affixed https://ru.wikipedia.org/wiki/Suid#setuid_.D0.B8_s...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question