LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Search this Thread
Old 07-15-2004, 03:39 AM   #1
bobgodwinx
LQ Newbie
 
Registered: Sep 2003
Posts: 5

Rep: Reputation: 0
how to protect a file with password


l've got a stupid but an inteligent question??? my question is this :
hoe do l place a password on a normal file in linux.??? cos' this is
simple in windows. please note am not talking about [.htaccess or
.htpasswd ] that are used for Apache. But am asking of how l can place a
password access on the scripts or configurazione files. e.g if l have a
script called "/usr/sbin/bobgodwinx" l would like to protect it with a
password so that when l do for example " vi /usr/sbin/bobgodwinx" l
should be asked a password
 
Old 07-15-2004, 08:57 AM   #2
huibert.alblas
Member
 
Registered: Jan 2004
Location: Duesseldorf /Germany
Distribution: Gentoo amd64 / Debian
Posts: 226

Rep: Reputation: 30
AFaik,
the linux way is to encrypt the file,
use a password as passphrase or key.

To use: decrypt -> use (-> encrypt again, or delete decrypted file)

You could also write a small script which take 2 params: file and passphrase.

Encrypts the file to a teporary file, lets you use it,
and ereses the tempfile afterwards...

Should not be to hard..
 
Old 07-18-2004, 04:48 AM   #3
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Or use user and group permissions so the system automatically knows if you should be able to read, write and/or execute the file or not...
 
Old 07-19-2004, 07:00 AM   #4
bobgodwinx
LQ Newbie
 
Registered: Sep 2003
Posts: 5

Original Poster
Rep: Reputation: 0
please can some make an example on how to encrypt files or directories with a key or passwd thanks
 
Old 07-19-2004, 10:45 PM   #5
qwijibow
Guru
 
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672

Rep: Reputation: 47
do yo have KDE ? kde has a nice graphical frontend to GPG called KGPG (or is it KPGP?)

PGP = Prety Good Privacy
GPG = GNU/Linux version of PGP

but you do know that if you 'chmod 600 /path/to/file' then that file will only be readable to you (and root). no need for encryption.

you may also want to look into encrypted partitons. it allows you to encrypt a whole disk, or directory.
 
Old 07-20-2004, 12:55 AM   #6
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
bobgodwinx: this may be simple in window, but it really doesn't do a damn thing, all it does is make it so windows doesn't let people that don't know the password use the file, but anyone can pop in a boot disk and go around windows all together (including the files password)

if its sensitive data, then encryption is best, if its lots of files, encrypt the disk partition (like to get encrypted directories)
 
Old 07-20-2004, 08:11 AM   #7
bobgodwinx
LQ Newbie
 
Registered: Sep 2003
Posts: 5

Original Poster
Rep: Reputation: 0
please can some make an example on how to encrypt files or directories with a key or passwd thanks. e.g l would like to encrypt /etc/samba/smb.conf with the following password 123456
can some make a command example please it's very important cos' CHMOD can't give passwd access it only gives read write and excution access. thanks
 
Old 07-20-2004, 08:47 AM   #8
qwijibow
Guru
 
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672

Rep: Reputation: 47
why would you want to encrypt samba.conf ?
you do realise that that would prevent samba from reading the file right ?

maybe you do not understand what encryption is ?

as for the exaple you want... that will come in the form of documentation with kgpg and gpg.

if you want to encrypt a whole disk, you will need to re-compile a 2.6.4 or above kernel and to use dm-crypt. (loop-aes is a mess, and crypto-loop is depreciated)
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password protect a directory aquatux Suse/Novell 6 08-01-2005 11:56 PM
Password protect folder? sall Linux - Security 4 07-18-2005 05:57 PM
Password protect directorys? xconspirisist Linux - Security 3 12-31-2004 08:26 PM
Looking for a way to password protect a file within my Home folder BadKarma Linux - Security 2 12-26-2003 08:13 PM
Password protect souvik Programming 0 05-22-2001 05:28 AM


All times are GMT -5. The time now is 09:47 AM.

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