Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 03-15-2006, 11:38 AM   #1
LQ Newbie
Registered: Jan 2006
Distribution: Debian
Posts: 12

Rep: Reputation: 0
Changing user in bash script.


I'm new to bash scripting, and I have a problem with running the 'su' command. When I try to 'su' in my script, I get prompted for the user's password. Is there any way to echo a password from my script to the waiting prompt??
Old 03-15-2006, 12:04 PM   #2
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
man su, and you'll find your answer.


Old 03-15-2006, 12:16 PM   #3
LQ Newbie
Registered: Jan 2006
Distribution: Debian
Posts: 12

Original Poster
Rep: Reputation: 0
I have already checked the man pages for 'su'. From what I can see, there is no -p option or anything to submit a password as an arguement to the 'su' command.
Old 03-15-2006, 12:27 PM   #4
Senior Member
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 56
If you can, there is a tool for this:

for su maybe with expect language but sudo is really for this.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
changing path from a bash script ggeeoo Linux - Newbie 7 01-04-2006 07:35 PM
add user bash script noir911 Programming 4 08-13-2005 09:24 AM
how to change user in bash script c0d3 Programming 6 07-27-2005 12:34 PM
changing user in a shell script sanjith11 Programming 6 03-22-2004 02:18 PM
User input using a BASH script... causticmtl Programming 5 07-13-2003 10:59 PM > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:47 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration