LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-28-2006, 07:59 PM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Rep: Reputation: 51
protect the start of an application using password


hi

howto write a script to protect the start of an application using password for example thunderbird ?

kind regards
cccc
 
Old 09-28-2006, 08:04 PM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
would it be better to add specific users to a group and allow only them the permissions to execute the command in question?
 
Old 09-28-2006, 08:24 PM   #3
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
yep, but cannot use it in my case and I need a script
 
Old 09-28-2006, 08:26 PM   #4
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
ok sorry, hope someone can give you some insight then
 
Old 09-29-2006, 07:06 AM   #5
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
I thought about this before. Encryption is the next thing that comes to mind after users/groups. Plus, even with users and groups the device could be mounted on another system and the binary copied. I'd do this:

1) create a small random file (maybe 3x the size of the binary itself)
2) loop the file using kernel encryption
3) create a file system on the loop
4) mount the loop and place your binary on the file system
5) unmount and unloop

In the script, all you have to do is loop/mount the encrypted file system image and execute the binary from it. If you need more specific help, let me know. Do you have kernel 2.6?
ta0kira

Last edited by ta0kira; 09-29-2006 at 07:08 AM.
 
Old 09-29-2006, 07:11 AM   #6
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
I believe a script in this case would be next to useless, as it relies on obfuscating the true location of the executable so that the script is called instead and a password must be given. If anyone was able to examine the script they could learn the location of the true executable, or even if they knew the executable's filesize they might be able to find it.
 
Old 09-29-2006, 08:15 AM   #7
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by Proud
I believe a script in this case would be next to useless, as it relies on obfuscating the true location of the executable so that the script is called instead and a password must be given. If anyone was able to examine the script they could learn the location of the true executable, or even if they knew the executable's filesize they might be able to find it.
That's why I suggested encryption. The script can make the losetup, dmcrypt, and mount calls while leaving the password up to the user. Anyone would be able to find the image, but no one would have the encryption password except the correct user, making it useless to anyone else.
ta0kira
 
Old 09-29-2006, 08:47 AM   #8
silent_cutthroat
LQ Newbie
 
Registered: Nov 2005
Distribution: Arch
Posts: 27

Rep: Reputation: 15
For such script to be useful you need to restrict the access to the executable you want to protect so only the script can execute it, but not a regular user. You can store a hash of the password not the password itself (for example md5 hash), then the script should require the user to enter the password, compute its hash value and compare it with the one already stored, if they match the script should execute the protected executable. The stored hash value also must be accessible only from the script.

Usually the easiest way to restrict the access to the protected executable is to set apropriate ownership/permissions, but then instead of using your own script you can use sudo. See its man page.
 
  


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
Password protect souvik Programming 3 11-06-2015 01:35 PM
Password protect a directory aquatux SUSE / openSUSE 6 08-01-2005 11:56 PM
Password protect folder? sall Linux - Security 4 07-18-2005 05:57 PM
Password Protect Folder?? sall Linux - Software 5 07-18-2005 06:58 AM
how to password protect certain directories? sirpelidor Linux - Security 3 10-06-2004 12:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:08 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