How to use `expect` tool to switch users?
Issue
- How to use
expecttool to switch users? - How can one execute
suwith password in plain text on the same command line? Is there any way to achieve this using some script? - When one executes
su - rootin terminal, it will show like this:
[user@localhost ~]$ su - root
Password:
[root@localhost ~]#
- It's required to have some tool/script to work as follows.
[user@localhost ~]$ su - root <someoption> password
[root@localhost ~]#
or
[user@localhost ~]$ su - root | cmd password
[root@localhost ~]#
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6.5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
