Originally Posted by karlochacon
I have to create a script
where I have to su to another user and when that happens the pasword is requested as usual but since this script runs after hours no one can type the password so..I now it's not secure but is there a way to do this to have the password inserted automatically?
thanks a lot
You can use 'expect' to do it. Many examples on the web to help you along. However, I'd not do this, for a wide variety of reasons, security chief among them.
You provide no real details here (version/distro of Linux, how you're connecting, etc.), but if I had to do this, I'd use SSH, and do a key-swap between the two boxes. That way, the user can log in without having to key a password, and the connection would be safe. You could even pass the command/script to run on the command-line from CRON if you chose.