I would like to write a bash script capable of executing a SU command with the "user" like a parameter. Then copy a file to that user's home directory and exiting the session (and the script). This is because I do not have root access.
However it doesn't work. After typing the user's password I am returned to the prompt and no copying is performed. The current user after the operation is the one in question (so the exit clause is not executed). If I type exit at that point I get the following error:
cp: cannot stat '/home/user/.procmailrc' : Permission denied
I am just a newbie with bash scripts, how can I change it so it does the job ?