LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-16-2006, 01:57 AM   #1
Bhaskar Gopalan
LQ Newbie
 
Registered: Jun 2006
Posts: 3

Rep: Reputation: 0
Encryption using Vi (X option). Cannot execute binary file.


Dear Sirs,

I am using encryption of my C-Shell file through Vi editor's X option. After saving the C-Shell file and when I tried to execute C-Shell file, the linux system says "cannot execute binary file". I have already made necessary permissions and executable using
chmod u+x filename
for the C-Shell commands file.

Kindly help me to solve this problem. Is there any other way of encrypting a csh file?. If so, kindly let me know.

Regards,
Bhaskar Gopalan
E-Mail : bhaskar_gopalan@rediffmail.com
 
Old 06-16-2006, 05:48 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
Well, if you encrypt your csh file, then first symbols are not #! - and so you have problems executing it.
What effect do you want to achieve? To make script unreadable? To make script unexecutable without password? How strong security do you want?

Generally, write a script that will decrypt and run its own tail after some comment, and prepend it to every encrypted script. But security will not be high.
 
Old 06-16-2006, 06:39 AM   #3
Bhaskar Gopalan
LQ Newbie
 
Registered: Jun 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Hello sir,

Even after I removed the #! option in the first line, the system says the problem namely "cannot execute binary file".

What I need in the encryption of the csh file is that the file should be unreadable alone with reasonable security.

Regards,
Bhaskar Gopalan
 
Old 06-16-2006, 06:42 AM   #4
Bhaskar Gopalan
LQ Newbie
 
Registered: Jun 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Hello sir,

Even after I removed the #! option in the first line, the system says the problem namely "cannot execute binary file".

What I need in the encryption of the csh file is that the file should be unreadable alone with reasonable security.

Regards,
Bhaskar Gopalan
 
Old 06-16-2006, 06:51 AM   #5
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
You still do not have first line with #! and then valid interpreter name.
About what you want: first, if it is executable without password it is in most cases readable without password also (except for cases with powerful compilers+obfuscators, when you can get something in assembler). Also if you do not want to complicate things too much, you have to decrypt file somewhere, and in that case root can find that moment of time and read the scripts. You can go to http://www.datsi.fi.upm.es/~frosal/sources/ and take shc - shellscript compiler which does approximately what you want. Or you can modify it to request password from keyboard which will make it not so vulnerable.
 
Old 06-16-2006, 06:25 PM   #6
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Two things.

First: vim != vi
There are those who think the two are synonymous since vim comes installed in most distros. They aren't. Vim is "vi-improved". Vi (and ex) are intended to be very short and sweet and small (and fast). Vim is also intended to be small and fast (compared to other editors), but it has many things vi doesn't. The reason I say this is twofold:
  1. Any newbies reading might become confused. That misconception will keep spreading.
  2. Vi and ex are pretty much guaranteed to be available on every system (even the really stripped down, minimal ones). One day, sooner or later, you will find yourself trying to debug a problem on such a computer. You should know the abilities/limitations of vi.
This isn't a slam on vim or on vi. It is just a simple statement that will better the understanding of unixes among all of us.

Second: If you encrypt a file, you need to decrypt it to use it!
Linux does many things but it doesn't automatically decrypt shell scripts encrypted in vim. What you need is to write a shell script wrapper. This wrapper copies an encrypted wrapper. Then it will decrypt that file. To do this, you probably need to invoke vim as `ex' and you can use it as a script. The encryption should then be turned off (in the ex script). Then, the C-sh file should be executed. Afterward, it should be deleted.
 
Old 06-17-2006, 08:40 AM   #7
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Moved: This thread is more suitable in Linux - Software and has been moved accordingly to help your thread/question get the exposure it deserves.
 
  


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
cannot execute binary file phanee Linux - Software 6 05-25-2006 01:16 PM
cannot execute binary file babaliciouse Linux - Software 2 10-21-2004 11:50 AM
Cannot execute binary file pbagda Linux - General 4 01-19-2004 01:13 AM
Cannot execute binary file Nooodle007 Linux - Software 2 06-25-2003 01:25 PM
cannot execute binary file.... ttaylor Linux - General 4 10-02-2001 01:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:17 AM.

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