Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Sudo reads password from a .cfg file Post 302956018 by dellanicholson on Thursday 24th of September 2015 05:34:05 PM
Old 09-24-2015
Sudo reads password from a .cfg file

cleanwork /saswork removes sas orphanded processes in the saswork directory. Subdirectories under sasem are sas94, sas92 and sasworks .

I am getting the following error messages:
1.
'/usr/bin/sudo -S apt-get update <~/opt/SiM/pos/ps/db_auth.cfg /sasem/sas92/sashome/sasfoundation/9.2/utilities/bin/cleanwork /sasworks'

line 69 '/usr/bin/sudo -S apt-get update <~/opt/SiM/pos/db_auth.cfg /sasem/sas92/sashome/sasfoundation/9.2/utilities/bin/cleanwork /sasworks: A file or directory in path does not exist

2.
'/usr/bin/sudo -S apt-get update <~/opt/SiM/pos/db_auth.cfg /sasem/sas94/sashome/sasfoundation/9.4/utilities/bin/cleanwork /sasworks'


line 76 '/usr/bin/sudo -S apt-get update <~/opt/SiM/pos/db_auth.cfg /sasem/sas94/sashome/sasfoundation/9.4/utilities/bin/cleanwork /sasworks: A file or directory in path does not exist


3.
-S apt-get update is not reading in the password from the db_auth.cfg file.

4.
How the sudo -S apt-get update <~/opt/SiM/pos/db_auth.cfg syntax works is when the sudo command prompts for a password, the password is read from db_auth.cfg.

5.
db_auth.cfg contents are as following (encrypt the password) :
DB_PASSWD="Swxftyi"
DB_PASSWORD=$(eval echo ${DB_PASSWD} | base64


6.
Code:
db_auth.cfg
DB_PASSWD="Swxftyi"
DB_PASSWORD=$(eval echo ${DB_PASSWD} | base64

7.
Code:
function cleanwork 
{
 set -x
    '/usr/bin/sudo  -S apt-get update <~/opt/SiM/pos/db_auth.cfg     /sasem/sas92/sashome/sasfoundation/9.2/utilities/bin/cleanwork /sasworks'
set +x
}

function cleanwork94
{
 set -x
    '/usr/bin/sudo  -S apt-get update <~/opt/SiM/pos/db_auth.cfg     /sasem/sas94/sashome/sasfoundation/9.4/utilities/bin/cleanwork  /sasworks'
set +x
}

./cleanwork

./cleanwork94

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

verify sudo password

edited and removed (0 Replies)
Discussion started by: mdpalow
0 Replies

2. Shell Programming and Scripting

sudo command with password

Hello everybody, Say I forgot my root password (shit happens, no?) and I'd like to brutally try 100 possibilities to delete a file using sudo. How can I make a script that tries all the passwords? The following doesn't work. Do you have a clue? foo:~$ cat test sudo rm dummy <<< 'password' echo... (1 Reply)
Discussion started by: chebarbudo
1 Replies

3. AIX

Sudo ask for password

Hello I have a partition with Aix 5.3 and I install sudo I put the commands that I want to use x user and I put the option that donkask for password. But when I run with this user and I try to run that commands. ask me for a password. I put this line for no ask for password with that... (2 Replies)
Discussion started by: lo-lp-kl
2 Replies

4. UNIX for Dummies Questions & Answers

Difference between buffered disk reads and cached reads?

I was analyzing the Disk read using hdparm utility. This is what i got as a result. # hdparm -t /dev/sda /dev/sda: Timing buffered disk reads: 108 MB in 3.04 seconds = 35.51 MB/sec # hdparm -T /dev/sda /dev/sda: Timing cached reads: 3496 MB in 1.99 seconds = 1756.56 MB/sec... (1 Reply)
Discussion started by: pinga123
1 Replies

5. Shell Programming and Scripting

password in sudo script

salmo allikm warhmat allah wabrakato i want to do script with sudo like sudo su and want to put password in the script not get from user because i to made it startup when booting and i don't know how put in script for sudo thanks (5 Replies)
Discussion started by: pua06
5 Replies

6. Shell Programming and Scripting

ssh foo.com sudo command - Prompts for sudo password as visible text. Help?

I am writing a BASH script to update a webserver and then restart Apache. It looks basically like this: #!/bin/bash rsync /path/on/local/machine/ foo.com:path/on/remote/machine/ ssh foo.com sudo /etc/init.d/apache2 reloadrsync and ssh don't prompt for a password, because I have DSA encryption... (9 Replies)
Discussion started by: fluoborate
9 Replies

7. UNIX for Advanced & Expert Users

problem creating pxelinux.cfg default file

Hi All, I was trying to create pxelinux.cfg/default file in a script that I use for creating backup of bootimage. cat 2>${BACKUB_BOOTIMAGE_ERRINFO} >${pxelinux_cfg_file} <<EOF prompt 1 timeout 0 display boot.msg label restore kernel kernel append root=/dev/nfs... (0 Replies)
Discussion started by: Pkumar Sachin
0 Replies

8. Red Hat

Sudo + Nohup = no password?

Little confused here When i go to run sudo nohup ./script.ksh & I dont get asked for a password. It starts a process ID, I can see it when i do a ps -ef | grep script. But I dont get an output file from my script, so its not doing anything. What gives? does it have to do the "&" ? ... (4 Replies)
Discussion started by: nitrobass24
4 Replies

9. Solaris

Sudo without password Solaris 11.2

Hi guys, I have the strangest issue... might be a huge oversight.. who knows!! :) I am trying to configure a user to use sudo with no password, here is my sudoers configuration file root@isha:~# egrep -v "^$|^#" /etc/sudoers root ALL=(ALL) ALL %wheel ALL=(ALL) NOPASSWD: ALL... (5 Replies)
Discussion started by: akame
5 Replies

10. Shell Programming and Scripting

Sudo password in shell file

Hi all, I have a script like this, where i am trying to login into oracle db via ssh and do a account unlock. #!/bin/sh ip=$1 os_user=$2 key=$3 ou_user=$4 ou_pass=$5 unlock_user=$6 ssh -i $key $os_user@$ip sudo -u $ou_user -p $ou_pass -- i am getting error here...its not taking... (16 Replies)
Discussion started by: onenessboy
16 Replies
add-apt-repository(1)					      General Commands Manual					     add-apt-repository(1)

NAME
add-apt-repository - Adds a repository into the /etc/apt/sources.list or /etc/apt/sources.list.d or removes an existing one SYNOPSIS
add-apt-repository [OPTIONS] REPOSITORY DESCRIPTION
add-apt-repository is a script which adds an external APT repository to either /etc/apt/sources.list or a file in /etc/apt/sources.list.d/ or removes an already existing repository. The options supported by add-apt-repository are: -h, --help Show help message and exit -r, --remove Remove the specified repository -y, --yes Assume yes to all queries -k, --keyserver Use a custom keyserver URL instead of the default REPOSITORY STRING
REPOSITORY can be either a line that can be added directly to sources.list(5), or in the form ppa:<user>/<ppa-name> for adding Personal Package Archives. In the first form, REPOSITORY will just be appended to /etc/apt/sources.list. In the second form, ppa:<user>/<ppa-name> will be expanded to the full deb line of the PPA and added into a new file in the /etc/apt/sources.list.d/ directory. The GPG public key of the newly added PPA will also be downloaded and added to apt's keyring. SEE ALSO
sources.list(5) COPYRIGHT
This manual page was written by Chow Loong Jin <hyperair@gmail.com> for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses. add-apt-repository(1)
All times are GMT -4. The time now is 02:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy