10-15-2019
Bash script for password changes help
I am super new to scripting and I am trying to create a bash script that is interactive that will change other user passwords as well as a few other thing (ie. change SMB pw, see pw expiration,lock/unlock user).
I have started it by making it check to see if the username entered is in the etc/passwd file. Where do I start if I want it to then display an interactive menu once a valid username has been found? I also would like it to loop back to the menu until the user selects the exit option.
10 More Discussions You Might Find Interesting
1. OS X (Apple)
I'm making a script that will be a double clickable .command file and I need it to prompt for the users admin password.
So far I have:
if ]; then
sudo -p "Please enter your admin password: " date 2>/dev/null 1>&2
if ; then
echo "You entered an invalid password... (2 Replies)
Discussion started by: PatGmac
2 Replies
2. Shell Programming and Scripting
Hi all,
I am running this script on Mandrakelinux release 10.1, 2.6.8.1-12mdksmp #1 SMP
I have also installed 'expect' separately.
I have created an Rsync script, but before any Rsync command does run, a MySql dump must be done first, and I am battling a bit to pass the MySql password from... (2 Replies)
Discussion started by: codenjanod
2 Replies
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
Hi all,
I'm a complete newbie to bash scripting, although I have some experience in programming. The thing is that I have a .dmg file on my mac which I protected with a password, and now I've forgotten it.
I remember the first few letters of the password and the characters that represent the... (4 Replies)
Discussion started by: sujay.jauhar
4 Replies
5. Shell Programming and Scripting
Hello
I am doing some test.
In a script I have to call a change password routine ( ldap ) which ask confirmation. This can be done from terminal.
Is there a way to do something like this :
#!/bin/bash
#
blabla
blabla
blabla
blabla
# changing_password_routine user_name... (2 Replies)
Discussion started by: jcdole
2 Replies
6. Shell Programming and Scripting
Is there a way to mask the password inside of a script to minimize the impact of a comprimised server? So
ssh -o "PasswordAuthentication no" -o "HostbasedAuthentication yes" -l testuser 192.168.3.1 "mysqldump --opt --all-databases -u root -pPassword| gzip" > $backup_dir/mysqldump.gz
a... (2 Replies)
Discussion started by: metallica1973
2 Replies
7. Shell Programming and Scripting
I want to give my long scripts to customer. The customer must not be able to read the scripts even if he has the password. The following command locks and unlocks the script but the set +x is simply ignored.
The code:
read -p 'Script: ' S && C=$S.crypt H='eval "$((dd if=$0 bs=1 skip=//|gpg... (7 Replies)
Discussion started by: frad
7 Replies
8. Shell Programming and Scripting
password check in bash script calling on expect
Background: I have to copy a file from one server, to over 100 servers in a test environment. once the file is copied, it requires to have the permissions on the file changed/verified. These are all linux servers. most of them have the same... (1 Reply)
Discussion started by: 2legit2quit
1 Replies
9. Solaris
Hi
I have a root script which is setting up user and his dirs and so on. After I create user and set up all the necessary I have to manually set user password. I try all possible ways what google find me and nothing works for me. If maybe one of you have a solution for my problem it will be... (1 Reply)
Discussion started by: Jaffakeks
1 Replies
10. UNIX for Beginners Questions & Answers
Dear Tech Guys,
I am trying to send some commands on the local server and it always asks for user name and password after each command. To serve the purpose I am using expect function as follows:
#!/usr/bin/expect
set timeout 20
spawn "./data1.sh"
expect "Please Enter UserName: "... (6 Replies)
Discussion started by: Xtreme
6 Replies
LEARN ABOUT OSF1
sia_chg_finger
sia_chg_finger(3) Library Functions Manual sia_chg_finger(3)
NAME
sia_chg_finger, sia_chg_password, sia_chg_shell - SIA change routines (Security Integration Architecture)
LIBRARY
Standard C library (libc.so and libc.a)
SYNOPSIS
#include <sia.h>
#include <siad.h>
int sia_chg_finger(
int (*collect)(),
char *username,
int argc,
char *argv[]);
int sia_chg_password(
int (*collect)(),
char *username,
int argc,
char *argv[]);
int sia_chg_shell(
int (*collect)(),
char *username,
int argc,
char *argv[]);
PARAMETERS
collect The collect parameter is a pointer to an SIA collection routine. If this pointer is NULL, no collection is possible. The col-
lect parameter should never be NULL. This parameter is read only.
Further information on the SIA change routines is available from the interface specifications in /usr/include/{sia,siad}.h.
username The username parameter is used when a precollected username is available. The username parameter either points to the precol-
lected username or is set to NULL if no username exists. This parameter is read only.
argc The argc parameter is the number of arguments used when invoking the calling command or utility. This parameter are read only.
argv The argv parameter is the array of arguments used when invoking the calling command or utility. The argv[0] variable must
always be set to the calling commands name. This is used for logging or auditing of the password change function.
DESCRIPTION
sia_chg_finger()
The sia_chg_finger() routine is used to change information about users in the /etc/passwd file. This information is used by the finger
program, among others. The user is offered a menu to choose which security mechanism is relevant to this invocation. If only one choice
is available that security mechanism is called directly.
sia_chg_password()
The sia_chg_password() routine is used to change the password in the security mechanism's database; for base security, its /etc/passwd and
for enhanced security its auth.db. If NIS is running, the password change is made in /var/yp/src/passwd or /var/yp/src/prpasswd files.
The routine assumes that the user might be registered with multiple security mechanisms and that those security mechanisms do not support a
common distributed transaction update capability. Consequently the sia_chg_password() routine first calls the siad_chk_user() security
dependent routine to obtain a list of relevant security mechanisms to offer to the calling user. The user is offered a menu to choose
which security mechanism is relevant to this invocation of password change. If only one choice is available that security mechanism is
called directly.
sia_chg_shell()
The sia_chg_shell() routine is used to change the login shell field of the /etc/passwd file. The user is offered a menu to choose which
security mechanism is relevant. If only one choice is available that security mechanism is called directly.
RETURN VALUES
The sia_chg_*() routines return SIASUCCESS when the are successful and SIAFAIL when they are not successful.
ERRORS
The errno value is not (normally) set explicitly by sia_* routines. The errno values are those returned from the dynamic loader interface,
from dependent (siad_*) routines, or from malloc. Possible errors include resource constraints (no memory) and various authentication
failures.
FILES
/etc/passwd
/etc/sia/matrix.conf
RELATED INFORMATION
chfn(1), chsh(1), passwd(1)
siad_chg_finger(3), matrix.conf(4)
Security delim off
sia_chg_finger(3)