Sponsored Content
Top Forums Shell Programming and Scripting Password in shell script for apps stop Post 302849519 by RavinderSingh13 on Monday 2nd of September 2013 03:54:46 AM
Old 09-02-2013
Hello,

It is never recommended to hardcode a password in a script.
Let me give you an example here.

Lets say you are using a user named user1 and services are owned by user user2. So create script for simple stopping and starting services and make owner as user2 (Note: if you don't have permissions for that you can contact root for same).

Then root can give you access for
Code:
 sudo

with non password option there. This means you will be able to run script with user1 (Which actually don't have access to STOP and START services directly) but this
Code:
sudo

access will give user1 ability to do so.



kindly let me know if I can help you further on same.


Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

stop Prstat using shell script

How to stop the Prstat using shell script ? because after i run the below script the thing seems to be always in loop and cannot get out till i ctrl + c, is there anything that i can add in the script to make it terminate ? <code> #!/bin/sh prstat -Tc -u testing > testing.txt </code> ... (19 Replies)
Discussion started by: filthymonk
19 Replies

2. UNIX for Dummies Questions & Answers

Stop a shell script

Hi, I am writing a bash shell script. How can I tell it to stop. For example, I would like to have something similar to the following: mike=1 if ; then STOP THE SCRIPT fi (3 Replies)
Discussion started by: msb65
3 Replies

3. Shell Programming and Scripting

How to stop asking password while running shell script?

Hello, I am ftping the file from one unix box to another box. This script works fine. Only problem here is, it is asking the password when ftp the file. How can i stop that. I am providing the password inside the shell script. But it is not accepting this. I need to put this script in crontab.... (5 Replies)
Discussion started by: govindts
5 Replies

4. Shell Programming and Scripting

how to change root password using shell script with standard password

Hi Friends. I am new to scripting now i want to change the root password using the script with standard password. which is the easy scripting to learn for the beginner, Thanks in advance. (2 Replies)
Discussion started by: kurva
2 Replies

5. UNIX for Dummies Questions & Answers

Script triggering Korn shell, how-to stop it?

Script_A.sh has echo "In am in script A" ksh ## K-shell is invoked. Script B.sh ## which I am writing... ./script_A.sh echo "I am in script B" return 0 When I run: $> Script_B.sh $> I am in script A $> Basically, on calling Script_A.sh from within Script_B.sh I have the issue of... (2 Replies)
Discussion started by: baivab
2 Replies

6. Shell Programming and Scripting

Help with stop/start Shell Script.

Hi All, I would like to develop a shell script for stop & start an application server (1-4) on Solaris box. Here are the user requirements for this task. 1. User will input the option which server they wish to stop. 2. Will clear cache files from specific location. 3. ... (1 Reply)
Discussion started by: venga
1 Replies

7. Shell Programming and Scripting

Stop! (the countdown!) :-) shell script help

Hi guys, I've found two nifty little scripts on these forums one which detects if the F5 key has been pressed: #/bin/sh _key() { local kp ESC=$'\e' _KEY= read -d '' -sn1 _KEY case $_KEY in "$ESC") while read -d '' -sn1 -t1 kp do _KEY=$_KEY$kp ... (0 Replies)
Discussion started by: rich@ardz
0 Replies

8. AIX

Shell script stop working

I have a strange problem. I have the following in a cron to find files older than a day. find /dir1/dir2/ ! -name . -prune -name "s*.txt" -type f -mtime +1 -exec echo {} \; | wc -w It was working fine for the last few days now it suddenly stopped working. I can clearly see files in the... (5 Replies)
Discussion started by: bbbngowc
5 Replies

9. Shell Programming and Scripting

How to trap APPS/Password dynamically in FCP_LOGIN?

Hi All, Bash shell is being used Could anyone please let me know - How to trap APPS/Password dynamically in FCP_LOGIN variable in bash shell script? Thanks for your time Regards, a1_win (1 Reply)
Discussion started by: a1_win
1 Replies

10. UNIX for Beginners Questions & Answers

How to stop a shell script if it encounters a error?

I am writing a bash shell script for GarazLab's "WP EMAIL CRAWLER - AUTO SCRAPER & REAL TIME EXTRACTOR". it contains some commands. I want to stop the shell execution as soon as it encounters an error. how to do it? (8 Replies)
Discussion started by: tahsin352
8 Replies
CGI
::Application::Plugin::Authentication::Driver::GeneriUsermContributed Perl DocumeCGI::Application::Plugin::Authentication::Driver::Generic(3pm) NAME
CGI::Application::Plugin::Authentication::Driver::Generic - Generic Authentication driver VERSION
This document describes CGI::Application::Plugin::Authentication::Driver::Generic version 0.20 SYNOPSIS
use base qw(CGI::Application); use CGI::Application::Plugin::Authentication; __PACKAGE__->authen->config( DRIVER => [ 'Generic', { user1 => '123', user2 => '123' } ], ); DESCRIPTION
This Driver offers a simple way to provide a user database to the CGI::Application::Plugin::Authentication plugin. It offers three ways to provide a list of users to the plugin by providing a hash of username/password pairs, an array of arrays containing the username and password pairs, or a code reference that returns back the username, or undef on success or failure. EXAMPLE
my %users = ( user1 => '123', user2 => '123', ); __PACKAGE__->authen->config( DRIVER => [ 'Generic', \%users ], ); - or - my @users = ( ['example.com', 'user1', '123'], ['example.com', 'user2', '123'], ['foobar.com', 'user1', '123'], ); __PACKAGE__->authen->config( DRIVER => [ 'Generic', @users ], CREDENTIALS => [ 'authen_domain', 'authen_username', 'authen_password' ] ); - or - sub check_password { my @credentials = @_; if ($credentials[0] eq 'test' && $credentials[1] eq 'secret') { return 'testuser'; } return; } __PACKAGE__->authen->config( DRIVER => [ 'Generic', &check_password ], ); METHODS
verify_credentials This method will test the provided credentials against either the hash ref, array ref or code ref that the driver was configured with. SEE ALSO
CGI::Application::Plugin::Authentication::Driver, CGI::Application::Plugin::Authentication, perl(1) LICENCE AND COPYRIGHT
Copyright (c) 2005, SiteSuite. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. perl v5.12.3 2011-05-16 CGI::Application::Plugin::Authentication::Driver::Generic(3pm)
All times are GMT -4. The time now is 03:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy