Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Shell Script for "Password Management" Post 303046110 by newbie_01 on Friday 24th of April 2020 03:48:11 AM
Old 04-24-2020
Hi,

Thanks for your reply.
Unfortunately, I can't use what you are suggesting. I am more or less looking for something 'simple' actually.
So there are several servers that I ssh to, I can copy the rsa keys to several hosts and then ssh with no password. So that's all well and good.
But there are also a Windows login, AWS login, database password login, my bank account login, just kidding, and several other 'clients' / customer that I support that I unfortunately cannot copy the rsa keys too.


So what am thinking is for each client, I create a text file with the login and password information and then I run the following



Code:
openssl enc -aes-256-cbc -salt -in list.txt -out list.txt.enc
openssl enc -aes-256-cbc -d -in list.txt.enc | cat

The first one is obviously an encrypt after which I delete the plain text file, and when I need to access the password information, I run the second command which is a decrypt and then copy and paste the output from the decrypt. xclip or any UNIX clip command are not available.


So it is kinda like a shell script for maintaining a text file that I encrypt and delete the text file and decrypt the encrypted file if/when I need to access the password information.


The other 'easier' option/alternative that I am hoping to have maybe is if I have the password text file as below:



Code:
mickey mouse
donald duck
bugs bunny

Then if I can encrypt and masked it like below:



Code:
mickey ******
donald ******
bugs ******

And then run an unmasked/decrypt that will toggle the ****** to show/hide the password.


At the moment, I can manage with using openssl to encrypt/decrypt. Just need some kind of menu/script to manage it maybe Smilie


I know there are other password management scripts/tools around for Linux/Unix, but unfortunately, as I am not the SysAdmin and the client possibly not approving to install such utility in the server, am left with only 'writing' my own shell script option with using one text file for each username/password Smilie Obviously, I still need to remember the one 'master' password that I used for doing the openssl -enc
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

No utpmx entry: you must exec "login" from lowest level "shell"

Hi I have installed solaris 10 on an intel machine. Logged in as root. In CDE, i open terminal session, type login alex (normal user account) and password and i get this message No utpmx entry: you must exec "login" from lowest level "shell" :confused: What i want is: open various... (0 Replies)
Discussion started by: peterpan
0 Replies

2. Shell Programming and Scripting

script that can give login password for "ssh" without involving STDIN

Hi Folks, I am writing a shell script that can logon to remote machine automatically. But, I am facing one problem. I am using "ssh" command in script and while login into remote machine it asks for passowrd and it stops for STDIN input for password. I want my script to supply password... (2 Replies)
Discussion started by: gydave
2 Replies

3. AIX

"too big" and "not enough memory" errors in shell script

Hi, This is odd, however here goes. There are several shell scripts that run in our production environment AIX 595 LPAR m/c, which has sufficient memory 14GB (physical memory) and horsepower 5CPUs. However from time to time we get the following errors in these shell scripts. The time when these... (11 Replies)
Discussion started by: jerardfjay
11 Replies

4. UNIX for Advanced & Expert Users

Customize "change password" in unix shell

I want to customize the "change password" through unix shell. when a user's password is expired and he/she logs into shell next time he/she will be asked to change his/her password. At this time when the user provides new password instead of unix doing the "password change" action I want to call my... (4 Replies)
Discussion started by: sharmanikhilesh
4 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Passing username and password to a script running inside "expect" script

Hi I'm trying to run a script " abc.sh" which triggers "use.sh" . abc.sh is nothing but a "expect" script which provides username and password automatically to the use.sh script. Please find below the scripts: #abc.sh #!/usr/bin/expect -f exec /root/use.sh expect "*name*" send... (1 Reply)
Discussion started by: baddykam
1 Replies

7. AIX

How to use 'expect' to pass UID & Password to a "for loop" in shell script?

Friends, Need someone's help in helping me with the below requirement for a script: > For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details < I know, this is possible through expect programming in a simple... (2 Replies)
Discussion started by: thisissouvik
2 Replies

8. Shell Programming and Scripting

How to use 'expect' to pass UID & Password to a "for loop" in shell script?

Friends, Need someone's help in helping me with the below requirement for a script: > For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details < I know, this is possible through expect programming in a simple... (14 Replies)
Discussion started by: thisissouvik
14 Replies

9. Shell Programming and Scripting

Can someone please show me a very simple "expect" script to change password in Solaris please?

Ladies & Gents, Can one of you gurus please show me a very simple "expect" script to change the password in Solaris in a script, please? Nothing fancy, no error checking, no nothing. Just to change the password of a new user, it's all. Many thanks in advance. U guys have honestly earned my... (1 Reply)
Discussion started by: Hiroshi
1 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
PASSWD(5)							   File formats 							 PASSWD(5)

NAME
passwd - password file DESCRIPTION
Passwd is a text file, that contains a list of the system's accounts, giving for each account some useful information like user ID, group ID, home directory, shell, etc. Often, it also contains the encrypted passwords for each account. It should have general read permission (many utilities, like ls(1) use it to map user IDs to user names), but write access only for the superuser. In the good old days there was no great problem with this general read permission. Everybody could read the encrypted passwords, but the hardware was too slow to crack a well-chosen password, and moreover, the basic assumption used to be that of a friendly user-community. These days many people run some version of the shadow password suite, where /etc/passwd has *'s instead of encrypted passwords, and the encrypted passwords are in /etc/shadow which is readable by the superuser only. Regardless of whether shadow passwords are used, many sysadmins use a star in the encrypted password field to make sure that this user can not authenticate him- or herself using a password. (But see the Notes below.) If you create a new login, first put a star in the password field, then use passwd(1) to set it. There is one entry per line, and each line has the format: account:password:UID:GID:GECOS:directory:shell The field descriptions are: account the name of the user on the system. It should not contain capital letters. password the encrypted user password or a star. UID the numerical user ID. GID the numerical primary group ID for this user. GECOS This field is optional and only used for informational purposes. Usually, it contains the full user name. GECOS means General Electric Comprehensive Operating System, which has been renamed to GCOS when GE's large systems division was sold to Honeywell. Dennis Ritchie has reported: "Sometimes we sent printer output or batch jobs to the GCOS machine. The gcos field in the password file was a place to stash the information for the $IDENTcard. Not elegant." directory the user's $HOME directory. shell the program to run at login (if empty, use /bin/sh). If set to a non-existing executable, the user will be unable to login through login(1). NOTE
If you want to create user groups, their GIDs must be equal and there must be an entry in /etc/group, or no group will exist. If the encrypted password is set to a star, the user will be unable to login using login(1), but may still login using rlogin(1), run existing processes and initiate new ones through rsh(1), cron(1), at(1), or mail filters, etc. Trying to lock an account by simply chang- ing the shell field yields the same result and additionally allows the use of su(1). FILES
/etc/passwd SEE ALSO
passwd(1), login(1), su(1), group(5), shadow(5) 1998-01-05 PASSWD(5)
All times are GMT -4. The time now is 02:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy