1

I have a system with an init script that launches multiple applications, each under it's right user and group. The init script checks the home directory of each user and looks for the application init script (/home/user1/init.sh), if found, it runs the following command:

/bin/su -c "/home/user1/init.sh start" - user1

I added a 'whoami' command at the beginning of the init script, and it fails with an error saying: whoami - unknown user id XXXX

The I added a sleep 5 command before the whoami command, ad I got user1.

What is the explanation of such behavior, and how can I fix it?

2
  • What does /etc/nsswitch.conf say is used for passwd lookups? The probable explanation is that the script is being called too early in the boot ptocess so the system has not yet set up how lookups should be done (files, ldap, yellow pages, nis+). Which is the init script that you added the wjoami to, the /home/user1/init or the one which calls it via su?
    – icarus
    May 29 at 11:36
  • I added the whoami to the /home/user1/init, and the init script that calls the 'application's init scripts' is S99.. which is the last script to run. May 29 at 11:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.