how to set password/encrypt a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to set password/encrypt a shell script
# 1  
Old 03-06-2010
Question 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
# 2  
Old 03-06-2010
using -x option.

Code:
vim -x file_name

When opening that file this will ask for encryption password.
Now you can set the encrypting password.

After setting the password when we are opening that file then it will ask for encrypted password.
If we given wrong password the original content will not be shown. It will show a crypt content until we are giving the correct password.

Last edited by thillai_selvan; 03-06-2010 at 02:07 AM..
# 3  
Old 03-06-2010
MySQL

In vim

in command mode use the X command
Code:
:X

it will ask the encryption key,
then you need to give the encryption key.

using this you can set the password to your file.
it will allow to you read the file with the help of encryption key.


if you want to remove the encryption key use the same command

it will ask the encryption key no need to give the encryption key simply enter is enough to remove the encryption key
of change the encryption key.

if you encrypt your script then your script will not execute.

Last edited by ungalnanban; 03-06-2010 at 02:16 AM..
# 4  
Old 03-06-2010
This question has been asked over and over and over and over again. Fact is: as long as the file has to be interpreted, it has to be readable by the interpreter, and by default is readable by the user running it. Even if you hid it inside a C program it would still be readable using the strings program. For ksh there's a tool called shcomp which "compiles" your script, but in reality it only converts it to a pre-parsed file, which can easily be de-parsed, eg. by running your script with the -x parameter.

If you really want to protect the algorithms you use, code it up in a high-level language, but even that can be de-compiled.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to set user password to never expire in UNIX servers

Hi, I have a requirement where in i need to write a shell script to set users password to never expire. I know the command which is used to perform the same .. which is chage command. But, could not figure out how to do the same in shell script. Could you please help me with the shell... (3 Replies)
Discussion started by: suren424
3 Replies

2. Shell Programming and Scripting

Encrypt and decrypt the password in a Shell Script

Hello, I have the following UNIX shell script which connects to the teradata database and executes the SQL Queries. For this, I am passing database name, username and password. I don't want to reveal my password to anyone. So, is there any way that I can encrypt my password and read the... (2 Replies)
Discussion started by: ronitreddy
2 Replies

3. Shell Programming and Scripting

Encrypt and decrypt a password in shell script

Hi All, very good morning all. I am trying to connect to informatica repository by using shell script. I have written pmrep connect command in the script file. But i need to provide repository, domain ,username and password to connect. Username and password are hard coded in the script... (8 Replies)
Discussion started by: SekhaReddy
8 Replies

4. Shell Programming and Scripting

Encrypt Password file and decrypt in a shell script

Hi All, I have stored Oracle database passwords in a hidden file - .pass_file. My shell script reads the hidden file, gets the password and then logs in to the Oracle database and runs some SQL script. My requirement is: I need to provide the shell script to be executed by someone else. So,... (1 Reply)
Discussion started by: sunpraveen
1 Replies

5. Shell Programming and Scripting

Encrypt DB password in Script

Hi, I have a SQL which i want to run through a shell script. query_result=`/home/oracle/product/11.2.0/bin/sqlplus -S uname/pwd@DBNAME <<! set heading off feedback off trimspool on set pagesize 0 set linesize 9999 spool $PARAM_PATH/param_name.txt; Select sysdate from dual; spool off;... (6 Replies)
Discussion started by: chetan.c
6 Replies

6. Shell Programming and Scripting

how to encrypt a password in shell script

Hi, I have run the below script which is connected to db2 v9.5. There is no issue. The only problem is how to encrypt the dbpwd? #!/bin/ksh #---- Set Environment dbalias="dev1db" dbuser="user1" dbpwd="password" #---- Connect to the Database cd /opt/ibm/db2/V9.5/bin db2 "connect to... (1 Reply)
Discussion started by: lookinginfo
1 Replies

7. Shell Programming and Scripting

How to hide/encrypt password in script?

Hi I have following problem Im writing a script (in bash ) , where need to be written login & passwd for databas client . Its need to in following form login passwd@dbhostname . The problem is so anybody can read it so the passwd & login are visible and thats not very safety . Can... (8 Replies)
Discussion started by: kvok
8 Replies

8. Shell Programming and Scripting

Can I set Password to open my shell script?

Hi All, please help me on how to secure my shell script? I chnanged it to read-only mode using 'chmod'. but still i would like to set password for open the script. Is there any way? Please help me!! Thankyou all in advance!! :b: (6 Replies)
Discussion started by: little_wonder
6 Replies

9. 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

10. Shell Programming and Scripting

Expect Script....encrypt password and use

Could someone please help me...I have an expect script. There's a need for a log in during the script and a password is required...right now the password is just a variable in the expect script...what would be the best way to put that in an encrypted flat file and have the expect script pull the... (2 Replies)
Discussion started by: cubs0729
2 Replies
Login or Register to Ask a Question