Обсуждение: Invalid 'runuser' usage

Поиск
Список
Период
Сортировка

Invalid 'runuser' usage

От
Alexander Lakhin
Дата:
Hello,
When trying to perform `setup initdb` on Centos 8 with an user-defined
PATH I get the following error:

[test@localhost ~]$ echo $PATH
/home/test/.local/bin:/home/test/bin:/usr/local/bin:/usr/bin

[test@localhost ~]$ sudo --preserve-env=PATH
/usr/pgsql-12/bin/postgresql-12-setup initdb
Initializing database ... failed, see /var/lib/pgsql/12/initdb.log

[test@localhost ~]$ sudo cat /var/lib/pgsql/12/initdb.log
/usr/pgsql-12/bin/postgresql-12-setup: line 143: runuser: command not found

Shouldn't the runuser be specified with the full path here?:
if [ -x /sbin/runuser ]
then
    SU=runuser

Best regards,
Alexander



Re: Invalid 'runuser' usage

От
Devrim Gündüz
Дата:
Hi,

On Mon, 2020-03-02 at 10:30 +0300, Alexander Lakhin wrote:
> When trying to perform `setup initdb` on Centos 8 with an user-defined
> PATH I get the following error:
>
> [test@localhost ~]$ echo $PATH
> /home/test/.local/bin:/home/test/bin:/usr/local/bin:/usr/bin
>
> [test@localhost ~]$ sudo --preserve-env=PATH
> /usr/pgsql-12/bin/postgresql-12-setup initdb
> Initializing database ... failed, see /var/lib/pgsql/12/initdb.log
>
> [test@localhost ~]$ sudo cat /var/lib/pgsql/12/initdb.log
> /usr/pgsql-12/bin/postgresql-12-setup: line 143: runuser: command not found
>
> Shouldn't the runuser be specified with the full path here?:
> if [ -x /sbin/runuser ]
> then
>     SU=runuser

I never aimed (and tested) this script to work with non-root user. Good point.
Will fix in next minor release.

Regards,

--
Devrim Gündüz
Open Source Solution Architect, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Вложения