Dear CentOS Community.
Can someone explain what changed in CentOS 8 regarding bash scripting?
We have some scripts that are installing a RPM package, put this in Startup scripts and starting a service. All was working fine till Centos 7 latest version. Now we get below error and we don't know how to deal with it (sorry a bit newbie here )
● *****.service - SYSV: *********
Loaded: loaded (/etc/rc.d/init.d/******; generated)
Active: active (exited) since Thu 2020-03-26 14:20:45 CET; 2s ago
Docs: man:systemd-sysv-generator(8)
Process: 17655 ExecStop=/etc/rc.d/init.d/****** stop (code=exited, status=127)
Process: 17713 ExecStart=/etc/rc.d/init.d/******* start (code=exited, status=0/SUCCESS)
Mar 26 14:20:43 ******3 systemd[1]: Starting SYSV: ****************...
Mar 26 14:20:43 *******3 ********[17713]: Starting *******: /etc/rc.d/init.d/**********: line 28: su: command not found
Mar 26 14:20:45 *******3 systemd[1]: Started SYSV: ******************.
Could someone help us on that?
su: command not found
Re: su: command not found
su in an sysV script? What for ? it is anyway run as root.
Member of centos-FR forum
Re: su: command not found
Sorry, I've owned all this from my predecessor...
Could you suggest something?
Could you suggest something?
Re: su: command not found
Check in the init script if this su command uses the absolute path name, if not add the full path name.
Systemd uses a very restricted set of environment variables when executing the scripts.
If that does not help:
Rewrite the SysV init script as a systemd .service file.
In the systemd service you can use "User=username" to run the program as the specified user.
Systemd uses a very restricted set of environment variables when executing the scripts.
If that does not help:
Rewrite the SysV init script as a systemd .service file.
In the systemd service you can use "User=username" to run the program as the specified user.
Re: su: command not found
Could you please let me know what changed regarding security on CentOS 8? All was working fine till Centos 7 latest release...
Re: su: command not found
It's not possible to tell what has changed, It's been 5 years between 7 and 8 and many things will have changed, some documented in the RHEL Release Notes upstream, others will have changed without notice. The best advice here is to turn your current initscript into a systemd unit file as they're really easy to write and will allow you to avoid the use of su at all.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: su: command not found
Ok, thank you very much. Will give it a try to rewrite that scripts or to adapt as you have suggested.