LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 01-10-2012, 08:26 AM   #1
s_linux
Member
 
Registered: Jul 2009
Posts: 83

Rep: Reputation: 15
question on encrypt passwords in shell script


Hello All
I have a script that does some ldap operations. Within the script, I have a password that I use in the ldapsearch and ldapmodify operations.
Also I want to cron this script. I want to encrypt password/script so that no one can see the account and password.
I tried with :X but once you do that, the script no longer executable. Was thinking to limit the permissions to only root but many ppl have root access so it does not work.
I can not install any other packages for this so that I can not use shc or some sort.

I wanted to see if there is any other process so that no one can see/read/open the script/password.
Thanks
 
Old 01-12-2012, 04:25 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hello,

Would this be an option? http://stackoverflow.com/questions/3...ally-seeing-it

Cheers,

Josh
 
Old 01-12-2012, 08:34 AM   #3
s_linux
Member
 
Registered: Jul 2009
Posts: 83

Original Poster
Rep: Reputation: 15
I'm not sure how that works with my script
I have a following script and password with in the variable admpwd. Instead of using the local variable, I dont know but may be put the password in a file and encrypt that file and use that file for the password...was something like that but again that did work for me..so checking for the other options
Quote:

#!/bin/bash
set -x
# Variables

server=111.111.111.11
userid=cn=xxxx,ou=xxxx,o=xxxx
admpwd=@@@@@@

testresult=`ldapsearch -x -h $server -LLL -d ou=xxxx,o=xxxxx-D "$userid" -w "$admpwd" "(cn=xxxx)" sn`
 
Old 01-12-2012, 08:55 AM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,160

Rep: Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266
if "many ppl have root access" then you have no security on this system anyway, so why bother?
 
Old 01-12-2012, 09:55 AM   #5
s_linux
Member
 
Registered: Jul 2009
Posts: 83

Original Poster
Rep: Reputation: 15
they have a root access on a server. but if I can protect the script somehow with a password and setup cron job, hoping no one can open/read the script without the password.

Regards
 
Old 04-02-2012, 11:39 AM   #6
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Rep: Reputation: 60
Have you looked into "shc"

http://http://www.linuxjournal.com/article/8256
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] can i encrypt a shell script HuMan-BiEnG Linux - General 18 08-25-2010 02:19 PM
crypt() perl function to encrypt Password in shell scripts or How Encrypt passwords ? balakrishnay Linux - General 13 01-14-2010 09:35 AM
[SOLVED] how to encrypt shell script bkcreddy17 Linux - Newbie 2 04-08-2009 06:51 AM
Reset users passwords using shell script rahmad Linux - Newbie 13 09-02-2008 04:04 AM
encrypt shell script Swakoo Linux - Security 29 02-08-2007 07:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 02:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration