# best way to encrypt file and folder



## mfaridi (Mar 8, 2010)

I use gpg to encrypt files and folder , 
Can I find another method for encrypt .
when I use gpg for encrypt it make file like sss.gpg and of some one see this files , it understand this file is encrypt with gpg ,
I want encrypt it and nobody do not understand this encrypt files. 
another problem with encrypt is this : when I encrypt it someone can delete this file ,
how I can solve this problem ?
I want encrypt file or folders and nobody can not delete this files.


----------



## sixtydoses (Mar 8, 2010)

mfaridi said:
			
		

> .. nobody can not delete this files.



You can try using `chflags sunlink file`.

http://www.freebsd.org/doc/handbook/permissions.html


----------



## SirDice (Mar 8, 2010)

Just simply setting the correct permissions will prevent anyone from deleting those files.


----------



## mfaridi (Mar 8, 2010)

Can I find another package for encrypt ?


----------



## SirDice (Mar 8, 2010)

mfaridi said:
			
		

> Can I find another package for encrypt ?



What for? There's never going to be any other that will prevent a user from deleting a file if that user has the permissions. Just set your permissions correctly. Encryption will not save you here.


----------



## mfaridi (Mar 8, 2010)

SirDice said:
			
		

> What for? There's never going to be any other that will prevent a user from deleting a file if that user has the permissions. Just set your permissions correctly. Encryption will not save you here.



but I want another package for encrypt . 
gpg make file like this sss.gpg
I do not like this because when someone look to this file , understand this file is encrypt .


----------



## SirDice (Mar 8, 2010)

mfaridi said:
			
		

> gpg make file like this sss.gpg
> I do not like this because when someone look to this file , understand this file is encrypt .


And if it's called sometext.txt and a user opens it s/he will also see it's encrypted. What's the problem? Knowing something is encrypted doesn't help, you still need to decrypt it to be able to read the clear text.

And again, if you don't want users reading it set your permissions accordingly.


----------



## jailed (Mar 8, 2010)

It may be sound stupid but you can write a script and alias it.


```
#!/bin/sh
file=$1
if [ "$file" ]
 then
  gpg # (your parametres here use $file for filename)
  /bin/mv $file.gpg $file # this will rename the file and remove gpg extension
  /bin/echo "$file is encrypted."
 fi
```

You can write the script to /bin/encrypt And write another script for decrypt, which do vice versa.


----------



## mk (Mar 9, 2010)

One system administrator:
With current progress of IT there will be needed 10 years to break the password for our database.
Officer from intelligence service took 6 minutes to break the password of which 3 minutes for ducktaping system adnimistrator to a chair...


----------



## Lowell (Mar 9, 2010)

If all you want is to have the encrypted files have a different extension, do that.  It doesn't matter what file extension you use; they have no real meaning on Unix.  GPG or any other program will use any extension you tell them to.


----------

