Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

> How to use 'chown' in Ubuntu?, chown: invalid group: ‘odoo:odoo’

views
     
TSk town shit
post Dec 11 2019, 10:05 PM, updated 2w ago

Casual
***
Junior Member
443 posts

Joined: Jan 2009
hello Lowyat People, I tried to execute command below, but it hits error:
CODE

sudo chown odoo:odoo /var/log/odoo


The error it returns is like following:
QUOTE
chown: invalid group: ‘odoo:odoo’
Any idea notworthy.gif ?

WongGei
post Dec 12 2019, 10:00 AM

Enthusiast
*****
Senior Member
895 posts

Joined: Dec 2007
From: Kuala Lumpur
Try this command "less /etc/group" to see if "odoo" is a group.
If odoo is not in the file, means the user "odoo" might be in other group.
Try command "groups adoo" and see what groups are user "odoo" in.
Try to assign an appropriate group when.
If you don't need to change the group ownership, can just ignore group
"chown odoo /var/log/odoo"
TSk town shit
post Dec 14 2019, 02:46 PM

Casual
***
Junior Member
443 posts

Joined: Jan 2009
[WongGei] I tried this command
CODE
 less /etc/group


I think there is no such user (odoo) was created
below is the result of the command above:

QUOTE
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:syslog,suzy
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:suzy
floppy:x:25:
tape:x:26:
sudo:x:27:suzy
audio:x:29:pulse
dip:x:30:suzy
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:suzy
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
systemd-journal:x:101:
systemd-timesync:x:102:
systemd-network:x:103:
systemd-resolve:x:104:
crontab:x:105:
messagebus:x:106:
input:x:107:
kvm:x:108:
render:x:109:
syslog:x:110:
bluetooth:x:111:
ssl-cert:x:112:postgres
uuidd:x:113:
tcpdump:x:114:
avahi-autoipd:x:115:
rtkit:x:116:
ssh:x:117:
netdev:x:118:
lpadmin:x:119:suzy
scanner:x:120:saned
avahi:x:121:
saned:x:122:
nm-openvpn:x:123:
whoopsie:x:124:
colord:x:125:
geoclue:x:126:
pulse:x:127:
pulse-access:x:128:
gdm:x:129:
lxd:x:130:suzy
suzy:x:1000:
sambashare:x:131:suzy
systemd-coredump:x:999:
postgres:x:132:



Then I also tried
CODE
groups odoo

but the result
QUOTE
is odoo : nogroup

So I don't think the user odoo was created before.

Any idea?

This post has been edited by k town shit: Dec 14 2019, 02:47 PM
wKkaY
post Dec 14 2019, 09:00 PM

misutā supākoru
Group Icon
Admin
5,914 posts

Joined: Jan 2003
There's probably a user called odoo, but not a group called odoo. You can probably chown that directory to odoo:root ...
hotfloppy
post Dec 16 2019, 06:53 PM

Getting Started
**
Junior Member
92 posts

Joined: Oct 2004
From: Baker Street, NW


assuming this is Odoo from https://www.odoo.com/ , their installation script should created the odoo group during installation.

CODE
# source: https://github.com/odoo/odoo/blob/13.0/setup/redhat/postinstall.sh

if ! getent passwd | grep -q "^odoo:"; then
   groupadd $ODOO_GROUP
   adduser --system --no-create-home $ODOO_USER -g $ODOO_GROUP
fi

but since yours does not, maybe its better to create the group yourself, to make sure the application wont misbehave.

CODE
# run as root

$ groupadd -g $(grep odoo /etc/passwd | awk -F':' '{ print $3 }') odoo
$ chown odoo:odoo /var/log/odoo

disclaimer: test the command on testing machine first. copy and paste at your own risk.

This post has been edited by hotfloppy: Dec 16 2019, 06:55 PM
TSk town shit
post Dec 28 2019, 04:59 PM

Casual
***
Junior Member
443 posts

Joined: Jan 2009
QUOTE(hotfloppy @ Dec 16 2019, 05:53 PM)
CODE
# run as root

$ groupadd -g $(grep odoo /etc/passwd | awk -F':' '{ print $3 }') odoo
$ chown odoo:odoo /var/log/odoo

*
Pardon me, I tried your command
$ sudo groupadd -g $(grep odoo /etc/passwd | awk -F':' '{ print $3 }') odoo


but it shows this error:

groupadd: GID '126' already exists

I searched for what does the $ and -g means , but I still did not get the answer, perhaps I can get a more straightforward answer here.

This post has been edited by k town shit: Dec 28 2019, 05:00 PM
hotfloppy
post Jan 2 2020, 04:18 PM

Getting Started
**
Junior Member
92 posts

Joined: Oct 2004
From: Baker Street, NW


» Click to show Spoiler - click again to hide... «
  • you can just create the odoo group without manually specify the gid.

    CODE
    $ id odoo
    $ sudo groupadd odoo
    $ sudo usermod -aG odoo odoo
    $ id odoo
    $ sudo chown odoo:odoo /var/log/odoo


    run man usermod to better understand -a (append) and -G (groups name)


  • the -g is an option for groupadd to manually specify the groupID (gid).
    you can check other options with man groupadd
    to understand more on how the command line works, you might want to check the first few minutes of this video [link].


  • and as for the $ sign, it has few meaning on Linux. but for this case, there's 2 $ .
    1. $() is use to execute a command within another command to use the output for those executed command
      to understand more, check out this discussion [link].

    2. and another $ is just a standard PS1 prompt to differentiate between normal user and root user.
      normal user prompt = $
      root user prompt = #

tboxmy
post Jan 6 2020, 04:00 PM

Casual
***
Junior Member
444 posts

Joined: Oct 2006


QUOTE(k town shit @ Dec 11 2019, 10:05 PM)
hello Lowyat People, I tried to execute command below, but it hits error:
CODE

sudo chown odoo:odoo /var/log/odoo


The error it returns is like following:

Any idea  notworthy.gif ?
*
Did you try the tip from "WongGei"?

The most simple way.

TSk town shit
post Jan 11 2020, 09:42 AM

Casual
***
Junior Member
443 posts

Joined: Jan 2009
QUOTE(WongGei @ Dec 12 2019, 09:00 AM)
Try this command "less /etc/group" to see if "odoo" is a group.
If odoo is not in the file, means the user "odoo" might be in other group. 
Try command "groups adoo" and see what groups are user "odoo" in.
Try to assign an appropriate group when.
If you don't need to change the group ownership, can just ignore group
"chown odoo /var/log/odoo"
*
I entered the command, then I can see
QUOTE
odoo:x:130:


Do u know what does x means?
malleus
post Jan 12 2020, 09:04 PM

Regular
******
Senior Member
1,202 posts

Joined: Dec 2011
QUOTE(k town shit @ Jan 11 2020, 09:42 AM)
I entered the command, then I can see
Do u know what does x means?
*
the `x` is supposed to be for password, but it has been just an `x` for the longest of time, since password shadow became the default setup. if you look inside /etc/passwd, you'll see the same thing too. actual encrypted passwords are stored in shadow and gshadow (readable to root and the shadow group only, while passwd and group are world readable

as for group passwords, I've never encountered a scenario where it is in use before
WongGei
post Jan 14 2020, 10:05 AM

Enthusiast
*****
Senior Member
895 posts

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(k town shit @ Jan 11 2020, 09:42 AM)
I entered the command, then I can see
Do u know what does x means?
*
Forget about the content of group file and concentrate on what you need to achieve, change the directory ownership.

 

Switch to:
| Lo-Fi Version
0.0327sec    2.43    5 queries    GZIP Disabled
Time is now: 23rd January 2020 - 01:02 AM