LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   how to protect a file with password (https://www.linuxquestions.org/questions/linux-security-4/how-to-protect-a-file-with-password-205276/)

bobgodwinx 07-15-2004 03:39 AM

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

huibert.alblas 07-15-2004 08:57 AM

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

Proud 07-18-2004 04:48 AM

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

bobgodwinx 07-19-2004 07:00 AM

please can some make an example on how to encrypt files or directories with a key or passwd thanks

qwijibow 07-19-2004 10:45 PM

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.

SciYro 07-20-2004 12:55 AM

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)

bobgodwinx 07-20-2004 08:11 AM

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

qwijibow 07-20-2004 08:47 AM

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)


All times are GMT -5. The time now is 04:13 AM.