Im finding trouble writing a script that runs from account A, switches user to B (on same server), performs a few jobs at B, and switches back to A. I want the password for B hardcoded in the script so that it doesnt prompt for one. Someone please help.
Jump to Post
Hardcoded passwords are a security risk - FWIW.
if you are root you can use sudo or su by default. Otherwise use a here document:
su username <<! password /bin/ksh command command command exit !
su may also give you the wrong shell, which is why …
All 3 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.