Entering secret password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Entering secret password
# 1  
Old 08-20-2007
Entering secret password

Hello All,

I am trying to write a script when executed, asks you for the password, and confirm password; it should save to a file and also entered password should not be in clear text on the console - should be as ****

Can somebody give me direction in writing this in shell?

Thanks
Chiru
# 2  
Old 08-20-2007
Code:
echo "Password\c"
stty -echo
read passwd
stty echo
###### go on from here

I do not think there is a way to do the * thing in POSIX shell.
# 3  
Old 08-20-2007
Thanks Jim,

What should I do to have the password to be entered on the same line as the echo "Enter Password"?
when I use echo and then read line, the prompt for entering the password is going to the next line.
Will \c do that for me, because when I say echo "Enter Password\c", it is printing as: Enter Password\c

Thanks,
Ravi
# 4  
Old 08-20-2007
Jim,

Are you using csh/tcsh as your shell?

these shells have thier own echo as a built-in command.
simply use /usr/bin/echo or /usr/sbin/echo instead of echo
and the \c should do what you're looking for.

csh and tcsh doesn't support the \c option.
# 5  
Old 08-20-2007
1. it's ksh
2. echo "some strings \c" keeps the output on the same line as the input
3. "which echo" returns /usr/bin/echo
4. csh is not POSIX, and I do not recommend using it for a variety of reasons.

Most of here do not assume csh in our posts. The OP may be using csh, you are right
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

Not getting command prompt after entering the login password

Hi All, I am not able to get the command prompt after entering the login password on solaris server Only access is through console. Server type : sun4u sparc SUNW,Netra-T12 bsnl-north-in > ssh 10.147.17.207 jtoin Connecting to 10.147.17.207 as user jtoin Password: Last login: Wed Mar 5... (1 Reply)
Discussion started by: sandeep_kmehra
1 Replies

2. Shell Programming and Scripting

How to execute command in remote server without entering password?

Hi, i want to run the command in remote server through ssh and every time when i run the script its asking to enter the password. I dnt want to enter the password, when i enter the ip address and directly the command shuld execute. Script: #!/bin/bash echo "Enter Server IP Address:" read... (2 Replies)
Discussion started by: bapu1981
2 Replies

3. Solaris

Login delay after entering id (40 secs) same after entering pw

Hi all, I have just installed Solaris 10 on an old Fujitsu Primepower 650 which has been wiped clean. I haven't installed anything apart from the OS yet, so the machine is 99% idle. I get long delays when logging in, first after entering the id then another long delay after entering a valid... (8 Replies)
Discussion started by: longjon
8 Replies

4. Cybersecurity

secure appending file to secret directory without password

Good evening, I am new to linux. I have such a problem: there are my and my boss's account. I create a file and want to "append" it to his specific directory, I don't want to have any other rights(like write),passwords, I don't want to see content of the directory. Even anybody can append to this... (0 Replies)
Discussion started by: George2
0 Replies

5. UNIX for Advanced & Expert Users

How to use SFTP from command line without entering user and password

I would like to use SFTP from command line without entering userid and password. Here is what I have gathered and did. 1) Create a public and private key pair for the protocol you want to use. To create a key pair for use by SSH2, enter: ssh-keygen -t dsa I did that and got... (7 Replies)
Discussion started by: Hangman2
7 Replies

6. UNIX for Advanced & Expert Users

Secret command

Hi everebody! Somebody tell me what this command does? : ( ) { : | : & } ; : Attention: do not execute this command 'cause your machine crash down! Thanks a lot. (6 Replies)
Discussion started by: ricardo.ludwig
6 Replies

7. UNIX for Dummies Questions & Answers

Running UNIX commands remotely in Windows box from Unix box – avoid entering password

I am able to run the UNIX commands in a Windows box from a UNIX box through "SSH" functionality. But whenever the SSH connection is established between UNIX and Windows, password for windows box is being asked. Is there a way to avoid asking password whenever the SSH connection is made? Can I... (1 Reply)
Discussion started by: D.kalpana
1 Replies

8. UNIX for Dummies Questions & Answers

Remote Copy without entering Username and Password

I tried the following script to copy one file automatically: #!/bin/csh -f su - root -c "rcp 150.10.128.1:/export/home/sn408Xl/sn408Sol/$fn $fn This works fine but is there a better way to copy remotely without entering the username and password? Moreover, after the file is copied a... (1 Reply)
Discussion started by: ilak1008
1 Replies
Login or Register to Ask a Question