It is possible to change the user within a shell script by
su - newuser; but what if the newuser needs authentication. How can I provide the password within the shell script?
None of the users is root.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Using passwords in plain text files is not recommended. However, if no security risk is involved, create an
expect script. Expect is a scripting language designed to interact with interactive shells and it is perfect for things like authentication or automation of processes that require a user to type in different things or select different options in a shell environment.