I have the strong feeling I'm trying to reinvent the wheel, but I did spend some time without finding an existing solution.
I have an already working shell script with several sudos. Its first target was admin users, so everything was ok. But now I'm hitting a roadblock for standard users. Sudo won't work, and as I must run this script on any machine any time, editing sudoers is not an option.
How can I rewrite this script so that it asks for admin user and password once, and then uses this credentials to run as many su as needed? What I'm particularly trying to do is feed password to one-line su but, security risk aside, I've never been able to use something as 'echo | su ...', as seen on forums.
sudoersfile will trigger the error. It doesn't matter if you're logged in as a standard user or an admin.
wheelgroup which is in the
sudoersfile. No single user, admin or standard is in the
sudoersfile unless explicitly put there by someone.