Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

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

views
     
hotfloppy
post Dec 16 2019, 06:53 PM

Getting Started
**
Junior Member
95 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
hotfloppy
post Jan 2 2020, 04:18 PM

Getting Started
**
Junior Member
95 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 = #


 

Change to:
| Lo-Fi Version
0.0121sec    0.20    6 queries    GZIP Disabled
Time is now: 29th March 2024 - 01:12 AM