Expect Script - Hide password from process table


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Expect Script - Hide password from process table
# 1  
Old 07-12-2012
Expect Script - Hide password from process table

i have an expect script that runs like this:

Code:
/usr/bin/expect -f /home/skysmart/commandstoexecute.sh host2.net b$4aff Skysmart

when i run this command, and i do a ps -ef and egrep for expect, i see the exact line in the process table and it shows my password for the world to see.

how can i encrypt it so it doesn't show up in ps -ef?

by the way i'm using:

shell: bash
hosts that the expect script is connecting to: linux red hat and sun os

Last edited by SkySmart; 07-12-2012 at 12:10 PM..
# 2  
Old 07-13-2012
In one word (LOL, actually two): you can't.

If you don't want passwords to show up in all the wrong places (process tables is just one of them), then use ssh and exchange private/public key pairs. This solves the problem as passwords are not used any more.

I hope this helps.

bakunin
# 3  
Old 07-13-2012
This is the reason you need to use a third-party brute-forcing utility like expect to kludge plaintext passwords into things: It's a subtle message, writ in mile-high flashing neon, that doing so is an extremely bad idea. As you've independently discovered.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to hide password in shell script?

I am writing a shell script for sql loader (just copy part of the code) : For security reason, I have to put the below loginName and password into another separate file instead of in the same file of this script. Anyone can give me a hand. Thanks. Shell Script :... (12 Replies)
Discussion started by: Jaewong
12 Replies

2. Shell Programming and Scripting

Expect script not expecting the password prompt

I have a script that does an SSH into a remote node. It should expect the prompt and send the password. #!/usr/bin/expect set user ; set pass ; spawn ssh $user@E-Internal expect { -re "RSA key fingerprint" {send "yes\r"} timeout... (1 Reply)
Discussion started by: Junaid Subhani
1 Replies

3. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies

4. Shell Programming and Scripting

Expect Script sending password with $ and symbols

All, I am trying to use expect to send SFTP password because I am unable to share a key with the vendor. They gave me a password that uses some symbols in it like $ and ! When i try to use the send command in expect it thinks the $ is a variable. Is there anyway to have it send the... (2 Replies)
Discussion started by: markdjones82
2 Replies

5. Shell Programming and Scripting

How to hide/encrypt password in script?

Hi I have following problem Im writing a script (in bash ) , where need to be written login & passwd for databas client . Its need to in following form login passwd@dbhostname . The problem is so anybody can read it so the passwd & login are visible and thats not very safety . Can... (8 Replies)
Discussion started by: kvok
8 Replies

6. Shell Programming and Scripting

Best way to hide password in bash script?

Dear folks, The title of my thread says mostly all of what I want to do. Basically I want to auto-ssh to a remote host, and run a program on it (VLC is just an example). I wrote a script which calls xterm and then runs expect on it. The code is as follow #!/bin/bash export PASS="xxxxxxx"... (22 Replies)
Discussion started by: dukevn
22 Replies

7. UNIX for Advanced & Expert Users

Encrypt the password ,source it in a expect script...!!

Hello folks I have a conf file ,say 'pass.conf' ,which is storing ascii password : PASS1111. I need to encrypt this password once and store it in a file. I ,then need to write a script which would read this encrypted password and decrypts it.The o/p o this script shud be this decrypted... (8 Replies)
Discussion started by: ak835
8 Replies

8. Shell Programming and Scripting

Expect Script....encrypt password and use

Could someone please help me...I have an expect script. There's a need for a log in during the script and a password is required...right now the password is just a variable in the expect script...what would be the best way to put that in an encrypted flat file and have the expect script pull the... (2 Replies)
Discussion started by: cubs0729
2 Replies

9. Shell Programming and Scripting

How Do I Hide the Password in a Script

Hi, I am writing a UNIX .ksh script and need to send the login password of the login id that is executing the script to a command that I am executing in the script. I don't want that password to be seen by anyone except whoever is executing the script. Does anyone know how I can accomplish... (6 Replies)
Discussion started by: samd
6 Replies

10. Shell Programming and Scripting

Password changing in a Script (shell and expect)

Hi, Does anybody know how to change the password on multiple servers with a script. I have 300 Sun boxes and the password expiry is set to 30 days. Im in a process to build a script using expect. Need a help from an expert who has already done it. Regards, Vinod (1 Reply)
Discussion started by: chellam
1 Replies
Login or Register to Ask a Question