Sponsored Content
Top Forums Shell Programming and Scripting Encrypt password but use * when typing password Post 302535324 by gary_w on Thursday 30th of June 2011 11:49:09 AM
Old 06-30-2011
Worked for me

Your script worked for me on Solaris exactly as copied:
Code:
$ getpw
password:***
the password is efs
$ getpw
password:***********
the password is thisisatest
$

the \c means suppress the newline after printing the string.

I would put the escape sequence inside the quotes though so you don't need to worry about escaping the escape sequence which is where I think your issue is.
Code:
echo "testing\c"


Last edited by gary_w; 06-30-2011 at 01:05 PM..
 

10 More Discussions You Might Find Interesting

1. Programming

hide password typing

I am doing a project in C program which requires to type in password in Unix terminal. Does anybody know how to shade or not output any words typed by user in the terminal? I use the function scan() to read typing from user. Thanks in advance. (2 Replies)
Discussion started by: ivancheung
2 Replies

2. Shell Programming and Scripting

encrypt and decrypt password

how do i encrypt and decrypt a password (2 Replies)
Discussion started by: sanwish
2 Replies

3. UNIX and Linux Applications

How to encrypt oracle password table ?

Hi Oracle & Unix expert, Could you tell me how to encrypt oracle table ? Thanks. (1 Reply)
Discussion started by: olaris
1 Replies

4. Shell Programming and Scripting

cronjob on a remote ssh without typing password

Hi there, How can I send a script to a remote ssh client. 1) I cannot connect through ftp 2) I just need to read a file on a remote server. Here is what I do: ~$ ssh santiago@myserver.com santiago@myserver.com's password: santiago@myserver:~$ cat logfile hello world bonjour le monde hola... (1 Reply)
Discussion started by: chebarbudo
1 Replies

5. Shell Programming and Scripting

Encrypt and save password

Hello all, I need to encrypt and save a password in a file and later decrypt to determine the original password string. Please suggest how can I use the linux commands or other approach to accomplish this. Thanks for your help. (1 Reply)
Discussion started by: cheerful
1 Replies

6. Shell Programming and Scripting

How to Encrypt password

Hello, I have a paramter file, In which I store all the user-ids and passwords for the project. So if a user just invokes the paramter file he has access to all the variables, which i have exported in the parmatere file. Now if a user echo's the variable which stores the databse password.... (1 Reply)
Discussion started by: DSDexter
1 Replies

7. AIX

SSH session closes after typing correct password

hi guys need some help. when ever i'm login ssh to aix server session always closed. when trying t0 type wrong password the session still continues, but we tried the correct password it automatically ends. what could be the problem to this please see .profile details ... (6 Replies)
Discussion started by: bocha
6 Replies

8. Shell Programming and Scripting

Encrypt DB password in Script

Hi, I have a SQL which i want to run through a shell script. query_result=`/home/oracle/product/11.2.0/bin/sqlplus -S uname/pwd@DBNAME <<! set heading off feedback off trimspool on set pagesize 0 set linesize 9999 spool $PARAM_PATH/param_name.txt; Select sysdate from dual; spool off;... (6 Replies)
Discussion started by: chetan.c
6 Replies

9. Shell Programming and Scripting

Encrypt Plaintext Password?

How do I encrypt a plaintext password that I need hardcoded in a bash script? (3 Replies)
Discussion started by: wyclef
3 Replies

10. UNIX for Beginners Questions & Answers

Encrypt and Decrypt a File with Password

Hello, I have few files on unix which are payroll related and I need them to encrypt with password so others wouldn't see the data. I use ETL tool and would like to know the unix command that does encryption/decryption to use in the ETL. Thank you, Sri (3 Replies)
Discussion started by: eskay
3 Replies
GETPW(3)						     Linux Programmer's Manual							  GETPW(3)

NAME
getpw - reconstruct password line entry SYNOPSIS
#define _GNU_SOURCE /* See feature_test_macros(7) */ #include <sys/types.h> #include <pwd.h> int getpw(uid_t uid, char *buf); DESCRIPTION
The getpw() function reconstructs the password line entry for the given user ID uid in the buffer buf. The returned buffer contains a line of format name:passwd:uid:gid:gecos:dir:shell The passwd structure is defined in <pwd.h> as follows: struct passwd { char *pw_name; /* username */ char *pw_passwd; /* user password */ uid_t pw_uid; /* user ID */ gid_t pw_gid; /* group ID */ char *pw_gecos; /* user information */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ }; For more information about the fields of this structure, see passwd(5). RETURN VALUE
The getpw() function returns 0 on success; on error, it returns -1, and errno is set to indicate the error. If uid is not found in the password database, getpw() returns -1, sets errno to 0, and leaves buf unchanged. ERRORS
0 or ENOENT No user corresponding to uid. EINVAL buf is NULL. ENOMEM Insufficient memory to allocate passwd structure. FILES
/etc/passwd password database file ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------+---------------+----------------+ |Interface | Attribute | Value | +----------+---------------+----------------+ |getpw() | Thread safety | MT-Safe locale | +----------+---------------+----------------+ CONFORMING TO
SVr2. BUGS
The getpw() function is dangerous as it may overflow the provided buffer buf. It is obsoleted by getpwuid(3). SEE ALSO
endpwent(3), fgetpwent(3), getpwent(3), getpwnam(3), getpwuid(3), putpwent(3), setpwent(3), passwd(5) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2017-09-15 GETPW(3)
All times are GMT -4. The time now is 06:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy