How to put su credentials in a script

Could someone please port an example of how to put su credentials in a script

ex: su - mqm (how do I define a password)
Los Angeles1Asked:
Who is Participating?
 
Seth SimmonsConnect With a Mentor Sr. Systems AdministratorCommented:
for security reasons, you can't do that

what you can do is define in sudoers that user running that command without prompting for a password

<your username> ALL=(ALL) NOPASSWD: <command>
0
 
MazdajaiCommented:
See post.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.