I have a big trouble, I need create a script that must switch user and then must execute
certain commands, sadly neither my user nor the second user have no privileges
for sudo, I've tried everything but seems su doesn't accept input redirection, please help me, it's very urgent
If you have the second user's password then you could write an expect script, but I wouldn't recommend it since you would have to hardcode their password in the script. It might look something like this:
Redirections aren't supposed to work with su. It will try and skip straight to a terminal device to prevent people trying shenanigans. Something more sophisticated like expect is needed to fool it.
And fooling it it is, since it's demanding interactive authentication for a reason. An expect script to cram a keyboard-authenticated password into a shell script is a very bad idea, anyone who sees the script will have the password. If you need permissions you haven't got, you should contact your sysadmin and get them.