Sponsored Content
Special Forums Windows & DOS: Issues & Discussions Add password to batch command? Post 302254496 by Lakris on Tuesday 4th of November 2008 02:24:54 PM
Old 11-04-2008
Hi, You can use:
read -s -p "password: " pass;echo
to have the entered password stored in the variable pass.

A few hints:
Anyone who can edit the script can also change it to for example echo $pass, a security risk...
create an encrypted passwordfile, for example with
echo lakris $(echo secretpassword | md5sum ) >> .mypasswd
Make sure the passwd file is only readable by the owner of the script
Test the entered and encrypted $pass against what's in the file for a given user.

It would be a very rudimentary password handling routine but this should get You started!

/Lakris
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Batch command

Hi All I have a need due time constraint to issue the mail command in background. I have a script that sends a message to a mail address as follows :- echo "$MLINE" | mail -s "$HOST - $TEXT" name@co.com & The script runs frequently and I check to see if the script is active and if it is , it... (5 Replies)
Discussion started by: jhansrod
5 Replies

2. UNIX for Dummies Questions & Answers

batch command in a shell script

How do I execute a batch command from a script, which "waits" with the next command until the first one has finished? ======= A piece of my script looks like this: #!/bin/sh (...) # run a long batch job: ./run_calculation.sh # then rename resulting file: mv output.dat backup.dat (...) ... (7 Replies)
Discussion started by: ivvo
7 Replies

3. UNIX for Dummies Questions & Answers

AT command to batch execute every x hours

I want to schedule a batch job (SQL)to run every 6 hours in Unix and the AT command syntax does not seem to cover this. I have created a file ncd_rpt in the directory report and have given the command in this file. at -f /report/ncd_rpt 1:00 am tomorrow I schedule this by running sh... (1 Reply)
Discussion started by: naveen79
1 Replies

4. Shell Programming and Scripting

su command in batch mode

Hi, how do we change user in a shell script- batch mode. Thanks, Rajesh (3 Replies)
Discussion started by: Rajesh Gohad
3 Replies

5. Windows & DOS: Issues & Discussions

How to call a command in a batch file?

Hi, I would like to get the output of below command emailed to me in a windows2003 server. "bpimagelist -hoursago 24 -U" I will be using "blat" to email the output of this command.But not sure how the above command is called for in a batch file when executed. Would appreciate if... (1 Reply)
Discussion started by: Hari_Ganesh
1 Replies

6. Shell Programming and Scripting

sftp batch script with password

I am working on a sftp batch script on a Solaris machine and I need to connect using password. This is not an issue when i do it manually but when I want to make this into a script, i find there are no options for password. Can anyone suggest how I can do it with password? I know using keys is... (3 Replies)
Discussion started by: Leion
3 Replies

7. AIX

How to write a script to run without password on a batch of servers?

I need run a command such as ps -ef |grep xxx on a batch of servers, how to write a script to run it without password? don't need go in each server to check? Thanks (7 Replies)
Discussion started by: rainbow_bean
7 Replies

8. UNIX for Dummies Questions & Answers

Script batch with command sed

hi, i have a folder with 2000 text file where each file contain a string. i need to trasform this string like this: example of file : My name is Mark and I'm a child the new file must be: insert into tabella ('My name','My name is Mark and I'm a child'); where the first column is a... (11 Replies)
Discussion started by: yo-yo78
11 Replies

9. UNIX for Advanced & Expert Users

Batch SFTP command Help

I need to run a test SFTP command in a batch mode and what I need to prompt my password after the sftp userid@hostname. I do not have have an ssh key exchanged between my server and the external server. I only have access to it as an sftp server. I must enter my password in my script. How do i... (2 Replies)
Discussion started by: mrn6430
2 Replies

10. 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
asadmin-version(1AS)						   User Commands					      asadmin-version(1AS)

NAME
asadmin-version, version - displays theversion information SYNOPSIS
version [--user admin_user] [--password admin_password] [--host localhost] [--port 4848] [--secure |-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive] [--verbose=false] version displays the version information. If the command-line cannot communicate with the administration server with the given user/pass- word and host/port, then the command-line will retrieve the Version locally and display a warning message. If the user option is not entered, the command-line will retrieve the version locally and display a warning message. The warning message will not be displayed if --terse option is entered on the command line. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. --echo setting to true will echo the command line statement on the standard output. --interactive prompts you for the required options that are not already specified. --verbose displays version information in detail. Example 1: Using remote mode to display version asadmin> version Java 2 Platform Enterprise Edition 1.4 Application Server Example 2: Using remote mode to display version in detail asadmin> version --user admin --password adminadmin --host bluestar --port 4848 --verbose Java 2 Platform Enterprise Edition 1.4 Application Server (build A021930-126949) EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-help(1AS) J2EE 1.4 SDK March 2004 asadmin-version(1AS)
All times are GMT -4. The time now is 02:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy