Help to set permission on password files in script


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
Help to set permission on password files in script

Hi Techies
I am stuck in a problem, I have written a script which is calling a second script which contains some command and password for quering on database. I do not want to disclose this command or specially password file. Please help..

Please have a look on directory structure and permissions on them...

Code:
$ ls -l
-rwxr-x---    1 user staff           254 Dec 14 08:21 C4jobs.sh
drwxr-x---    2 user staff           256 Dec 14 08:30 testing

$ls -l testing 
-rwxr-x---    1 user staff            38 Dec 10 07:08 dspas
-rwxr-x---    1 user staff          1521 Dec 14 08:14 jobstatus1.sh

$cat C4jobs.sh
#!/bin/ksh
SHOME=/home/user/testing

if [[ $# -eq 0 ]]; then
echo "Please use this script like this :  /home/user/C4jobs.sh Job_No";
else
choice="$1";
fi
$SHOME/jobstatus1.sh $choice > dsjobresult 2>&1
----end of script -------------

Now as you can see I have given 750 permission to dir "testing" , files "C4jobs.sh", "jobstatus1.sh" and "dspas".

"dspas" contains the password where "jobstatus1.sh" contains the commands. I have given permission to user to execute "/home/user/C4jobs.sh" which is calling script " jobstatus1.sh" which is using the password from "dspas" files.

I want to secure dspas file as this file also have the permission of 750.
Please guide me to set the permission or if there is another way to secure, please share.


Thanks
Atul Singh
# 2  
You can use the crypt command to lock down a file. Check out the usage here:

https://www.unix.com/unix-dummies-que...using-key.html
# 3  
You can, sure... But if the program has to decrypt that file to use it, you've just handed out instructions on how to read that encrypted file to the world.

If I was genuinely worried about keeping a file secret, I'd set up a separate user account to hold secret things and configure sudo so they could sudo commandname to run it. No access otherwise.

And if you're trying to keep things secret from users with administrator access? You're just plain out of luck.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #956
Difficulty: Medium
A polymorphic virus infects files with an encrypted copy of itself which is decoded by a decryption module which is modified on each infection.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help needed with shell script to search and replace a set of strings among the set of files

Hi, I am looking for a shell script which serves the below purpose. Please find below the algorithm for the same and any help on this would be highly appreciated. 1)set of strings need to be replaced among set of files(directory may contain different types of files) 2)It should search for... (10 Replies)
Discussion started by: Amulya
10 Replies

2. HP-UX

Sudo entry required to set permission similar to ROOT without using password (PASSWD) change optio

Hi All I had installed sudo in HP UX 11.3 and it is working fine but not able to make entry required to set permission similar to ROOT without using password (PASSWD) change option for define user in /etc/sudoers file Please help if some know the syntex? :confused::wall: (2 Replies)
Discussion started by: deviltech
2 Replies

3. Shell Programming and Scripting

Script to set password in HP-UX 11.31

Hi, I am unable to set the password remotely. I am using the script as below: ep=`echo "$p" | /usr/lbin/makekey` ssh -t $i "/usr/local/bin/sudo useradd -c "$user_c" -m -d /home/$user_id -s /bin/ksh $user_id; /usr/local/bin/sudo /usr/sam/lbin/usermod.sam -F -p $ep $user_id" The... (0 Replies)
Discussion started by: Kits
0 Replies

4. Shell Programming and Scripting

Need a script to set non-expiry password

Hi All, I have a gateway server, from where I can connect any server via 'sudo ssh server_name'. Generally, if we need to run a command on any number of servers, we put server names in a file like '/tmp/ser_name' and execute it with for loop from gateway server. Now, I need to set non-expiry... (0 Replies)
Discussion started by: solaris_1977
0 Replies

5. Shell Programming and Scripting

script to set the password from *LK* to *NP*

okay here I go again... I have created a script which adds new user to /etc/password and which inturn creating a locked password in /etc/shadow but I am expecting to have *NP* for that particular user.Can someone help me with a script which can set the password for a particular user to NP in... (1 Reply)
Discussion started by: sintilash
1 Replies

6. Shell Programming and Scripting

how to set password/encrypt a shell script

Hi, I have written a shell script in unix for my customer. Now I want to make it only execute and not to read/write. Can anybody help me how to set password protect/encript my script. Thanks Suresh (3 Replies)
Discussion started by: suresh3566
3 Replies

7. UNIX for Dummies Questions & Answers

Change permission for a set of files

Hi there, I want to change from this permission -r-xr-xr-x to -r-xr-xr-- for a set of files under unix. Can someone help me to go-about doing this in one shot. Cheers, RN (2 Replies)
Discussion started by: karthickrn
2 Replies

8. Shell Programming and Scripting

set password using a shell script

Hi All How can I set password in linux.It is OK if it display password in plain text in script. manually i can set: #passwd Changing password for root Enter new password: Bad password: too weak. Re-enter new password: Password changed. # I want this to be done by script.Please let me... (2 Replies)
Discussion started by: tannu
2 Replies

9. AIX

set permission to files in /tmp

Trying to setup user to have the ability to delete any files (regardless of owner) in /tmp. I've tried almost everything... the permission on the folder is drwxrwxrwt 10 bin bin, and at one point I give all the possible permission (short of root) I can give to the user, and he still can't delete... (2 Replies)
Discussion started by: cchiang12
2 Replies

Featured Tech Videos