-2

let's say that we have this situation :

-rwxrwx-w- 1 user1 mygroup  0 Sep 12 16:53 testfile

Can a sudoer change this file ownership ? does he have to be a sudoer on command chown or on file ?

Elias
  • 89
  • 10

1 Answers1

2

I missed the point that the ownership of any file in the system may only be altered by a super-user.

The 2nd set of rwx shows that any user who is a member of mygroup can read, write and execute this file.

So, if the user user2 is a super-user (present in sudoers and have sufficient permissions), he can make the necessary changes. If not, then he / she can't modify the ownership!

Am_I_Helpful
  • 18,735
  • 7
  • 49
  • 73
  • just tried it doesn't work, because of the need to use chown as a sudoer , is there any possibility to change file ownership without being a sudoer – Elias Sep 12 '17 at 17:06
  • @llyasse - Sorry, I've made the edit. The other user can only change the ownership if he is a super-user. Please check the Wikipedia link too. – Am_I_Helpful Sep 12 '17 at 17:10
  • yeaah exactly , but the doc also shows that a file owner can run chown without sudo thing that i couldn't get to work . – Elias Sep 12 '17 at 17:11
  • @llyasse - Which documentation are your referring to? I didn't find any for getting the clarification! – Am_I_Helpful Sep 12 '17 at 17:13
  • sorry it's in frensh , The command chown( ch ange own er , change the owner) allows you to change the owner of the file. Only the superuser or current owner of a file can use chown. The command is used as follows ==> https://doc.ubuntu-fr.org/permissions – Elias Sep 12 '17 at 17:15
  • @llyasse - I tranlsated into English; the content is similar to what is mentioned in Wikipedia. – Am_I_Helpful Sep 12 '17 at 17:16
  • yes i'm talking about the owner part , they say if the user is file owner he can change ownership but when i run chown without sudo it doesn't work – Elias Sep 12 '17 at 17:17
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/154256/discussion-between-am-i-helpful-and-ilyasse). – Am_I_Helpful Sep 12 '17 at 17:18