2
0
I trying change owner of a directory. There was a mess before that about /etc/group file. There was a group named "500" and oinstall group id was 15001. I changed these configs manually via group file and I rebooted the system.
After that I check the directory for user and group and these like "oracle 500". There is no group named "500" in /etc/group I used "chown" command for change the group 500 to oinstall but system gave an error like this:
[root@myserver /]# chown -R oracle:oinstall /dir
chown: invalid group: `oracle:oinstall'
note:
[root@myserver /]# getent passwd oracle
oracle:x:500:500::/home/oracle:/bin/cdax/bash
[root@myserver /]# getent group oinstall
[root@myserver /]# chown -R oracle:oinstall /dir
chown: invalid group: `oracle:oinstall'
[root@myserver /]# grpck -r
'rooty' is a member of the 'rooty' group in /etc/group but not in /etc/gshadow
no matching group file entry in /etc/group
delete line 'arda:!::'? No
no matching group file entry in /etc/group
delete line '500:!::'? No
grpck: no changes
oinstall /etc/group file:
[root@myserver /]# cat /etc/group | grep oinstall
oinstall:x:500:
I can see oinstall in group file but still chown/chgrp command doesn't work correctly:
[root@ANIPTORCLT01 /]# chgrp oinstall /dir
chgrp: invalid group: `oinstall'
chown treats numeric values as user/group IDs not user/group Names. https://linux.die.net/man/1/chown
– Frank Thomas – 2017-12-29T13:47:19.1701actually chown allows name i knew so. I use chown with name always. btw i tried with id but didn't work. – Gefolge – 2017-12-29T14:42:49.617
Please provide the output of both
getent passwd oracle
andgetent group oinstall
. – Charley – 2017-12-30T01:10:26.0931i added the outputs to end of question @Charley – Gefolge – 2018-01-02T06:37:58.013
1cuz there is no output of getent oinstall @KamilMaciorowski – Gefolge – 2018-01-02T09:02:42.040
1sorry for my attention. but the output is same, empty. – Gefolge – 2018-01-02T09:10:09.157
I've read your comment under my answer (and I still think you should add the
groupadd ...
fragment to your question). I cannot replicate the issue. For now I think there may be some elusive error or inconsistency in your/etc/group
and/or/etc/gshadow
. Can you add a group with another name? Can you add a group with anothergid
? – Kamil Maciorowski – 2018-01-08T07:05:00.0871I added oinstalll group with 3 "l" letters and 50000 gid but there is no difference about error. invalid group. I can see it in gshadow and group files as correct. But error is there still. – Gefolge – 2018-01-08T11:41:45.830