I need to request certain commands via su
including password in one line.
I found a solution and it is working in a standard environment (Ubuntu) (more about solution here):
{ sleep 1; echo password; } | script -qc 'su -l user -c id' /dev/null | tail -n +2
But I am faced with the problem that this solution is not suitable in a Docker container environment
Script
terminates the command without waiting for echo
and as a result i get:
su: Authentication failure
Any help is much appreciated.