LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-13-2008, 03:45 PM   #1
nabeeliumattack
LQ Newbie
 
Registered: May 2008
Posts: 2

Rep: Reputation: 0
Post Howto Encrypt & Run Bash script File


Hi,

I have written bash script file but I have one problem

my code, I don't want any one read my code ( manager only can read the code )

But If I encrypt this script if I run it it can be run simply like any script using

sh filename.sh

but If any one try to open this script to read the code

no thing from I have written can be seen

only I want to give permition to run it only

I don't want methods like "crypt" command it can encrypt but can't be executed

also I want any method to decrypt this file using password or something like that for me only

thanks alot, bye

Last edited by nabeeliumattack; 05-13-2008 at 03:51 PM.
 
Old 05-13-2008, 04:01 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,944
Blog Entries: 54

Rep: Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731
In short encryption is pretty much worthless since it a) needs to be decrypted before execution, b) reside somewhere unprotected upon execution and c) the root account user can read everything anyway. Protection schemes aren't true F/OSS spirit anyway IMNSHO.
 
Old 05-13-2008, 07:00 PM   #3
SlowCoder
Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Fedora (Desktop), CentOS (Server), Knoppix (Diags)
Posts: 934

Rep: Reputation: 38
Quote:
Originally Posted by unSpawn View Post
Protection schemes aren't true F/OSS spirit anyway IMNSHO.
I read it more like a security thing than an "I wrote it, it's mine and I ain't sharing" thing. It could be that the OP is trying to keep normal users from being able to see how the script does something. It would be more difficult for someone to find a hole in your firewall if they don't have access to your scripts, right?
 
Old 05-13-2008, 07:37 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,225

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
As per unSpawn, what you're asking is more or less not possible.
What you could do is use sudo to ensure that users can only run it, but not see the src.
Either give the script its own 'owner' or give it to root.
 
Old 05-13-2008, 09:14 PM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,519

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
I once used this:
http://www.datsi.fi.upm.es/%7Efrosal/
"Shc is a generic shell script compiler. It takes a script which is specified
on the command line and produces C source code. The generated source code
is then compiled and linked to produce a stripped binary executable."
 
Old 05-14-2008, 01:06 AM   #6
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,225

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Interesting, let us know how well that works for you...
 
Old 05-15-2008, 05:03 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,944
Blog Entries: 54

Rep: Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731
Quote:
Originally Posted by SlowCoder View Post
I read it more like a security thing than an "I wrote it, it's mine and I ain't sharing" thing. It could be that the OP is trying to keep normal users from being able to see how the script does something. It would be more difficult for someone to find a hole in your firewall if they don't have access to your scripts, right?
Could be, sure, but since the OP didn't post back yet all that remains is speculation.


Quote:
Originally Posted by knudfl View Post
I once used (..) Shc
See related threads (mostly in the Linux Security forum) and Limitations of shc, a Shell Encryption Utility (Linuxjournal, 2005)?
 
Old 05-17-2008, 04:58 PM   #8
nabeeliumattack
LQ Newbie
 
Registered: May 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Smile thanks alot all of you ...

Many thanks all of you ,

I think the best way to do my mission by using Shc

using C language I can do what I want then I can run encrypted file

I love all of you , sorry iam so busy now a days

My Holiday is in 15-6-2008 after this day I will try to do this


Last edited by nabeeliumattack; 05-17-2008 at 05:01 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does anyone know of a bash script can search & replace txt in a file. jimwelc Linux - Newbie 6 09-15-2008 12:13 AM
How to run a BASH script in a Batch file (with Cygwin) FaeDine Programming 2 10-27-2007 04:47 PM
bash script: run multiple jobs in bg, & kill them separately? mattengland Programming 1 03-26-2006 05:07 PM
Compile/Encrypt Bash Script DoubleOTeC Programming 6 10-09-2005 07:33 PM
howto run blackbox in bash? ichbinesderelch Linux - Software 3 10-22-2003 12:45 PM


All times are GMT -5. The time now is 01:45 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration