Skip to content Gå til innhold


How to password protect files in Linux Hvordan passordbeskytte filer i Linux

LinuxSikkerhet

If you store important information on your Linux server and want to make sure it is for your eyes only you need to password protect these files. Hvis du lagrer viktig informasjon på din Linux-server og vil sørge for at det er for øynene bare du trenger å passordbeskytte disse filene. Let's see how you can do this with Linux. La oss se hvordan du kan gjøre dette med Linux.

First, pick a good password. Først velger et godt passord. There are a few websites on the Internet that help you generate strong passwords. Det er noen nettsteder på Internett som hjelper deg å generere sterke passord. Try and pick an alphanumeric password. Prøv og plukke en alfanumerisk passord. Something such as Rv7fkcxASW8h would be a good choice. Noe som Rv7fkcxASW8h ville være et godt valg.

Now check to see if you have the package gpg installed on your computer. Nå sjekk for å se om du har pakken gpg installert på datamaskinen. Run the following command to check: Kjør følgende kommando for å sjekke:

# whereis gpg # Whereis gpg
gpg: /usr/bin/gpg /usr/share/man/man1/gpg.1.gz gpg: / usr / bin / gpg / usr/share/man/man1/gpg.1.gz

If you get an output like the one shown above it means you have the required package installed. Hvis du får en produksjon som vist ovenfor, betyr det at du har de nødvendige pakken installert. If not, check your Linux distribution's documentation to see how you can install the GPG package. Hvis ikke, sjekk din Linux-distribusjon dokumentasjon for å se hvordan du kan installere GPG pakken.

Say you want to password protect a file called dbbackup.zip with the password Rv7fkcxASW8h here's how you would go about it: Si at du ønsker å passordbeskytte en fil som heter dbbackup.zip med passordet Rv7fkcxASW8h her er hvordan du vil gå om det:

# gpg -c dbbackup.zip # Gpg-c dbbackup.zip

When you enter this you will be requested to enter a passphrase, which is the password you want to protect the file with. Når du går inn på denne vil du bli bedt om å oppgi et passord, som er passordet du vil beskytte filen med. Enter the password twice. Skriv inn passordet to ganger. Now you should see a file called dbbackup.zip.gpg in the same directory as the original file. Nå burde du se en fil som heter dbbackup.zip.gpg i samme mappe som den opprinnelige filen. This is the encrypted and password protected copy of the original file. Dette er kryptert og passordbeskyttet kopi av den originale filen. You can store this file on your hard drive or ship it to someone on a DVD knowing that it will be very hard and nearly impossible for most people to crack it. Du kan lagre denne filen på harddisken eller sende den til noen på en DVD vite at det vil være svært vanskelig og nesten umulig for folk flest å knekke den.

When you want to read the file you will need to remove the password protected encryption. Når du ønsker å lese filen må du fjerne passordbeskyttet kryptering. For that execute the following command: For at den følgende kommando:

gpg dbbackup.zip.gpg gpg dbbackup.zip.gpg

You will be asked to enter the password using which the file was protected. Du vil bli bedt om å angi passordet ved hjelp der filen ble fredet. Enter that and you should be in business. Skriv det og du bør være i virksomhet. Note that this only works for files and not for folders. Merk at dette kun fungerer for filer og ikke for mapper. You should create a zip or tar archive of the files you want to secure and then add the password protected encryption to it. Du bør lage en zip eller tar-arkiv av filene du ønsker å sikre og deretter legge til passordbeskyttet kryptering til det.

Posted in Posted in Linux Linux , , Security Sikkerhet . .

Get Simple Help tutorials just like this one in your email inbox every day - for free! Få Enkelt Hjelp opplæring akkurat som dette i innboksen hver dag - helt gratis! Just enter your email address below: Bare skriv inn din e-postadresse nedenfor:

You can always opt out of this email subscription at any time. Du kan alltid velge bort denne e-abonnementet når som helst.

3 Responses 3 Svar

Stay in touch with the conversation, subscribe to the Hold kontakten med samtalen, abonnere på RSS feed for comments on this post RSS feed for kommentarer til dette innlegget . .

  1. IT Buzz IT Buzz says sier

    Thanks a lot i was looking for this command from last week. Thanks a lot jeg var på utkikk etter denne kommandoen fra forrige uke. Ultimately find it at your website. Til syvende og sist finne det på nettstedet.

Continuing the Discussion Fortsetter Discussion

  1. | Standalone Sysadmin | Frittstående Sysadmin linked to this post on June 29, 2009 knyttet til dette innlegget 29 juni 2009

    [...] to ssh authentication. [...] Til ssh autentisering. If you want to learn more about how to use it, Simple Help has a tutorial on it, covering the very basic usage. Hvis du vil vite mer om hvordan du bruker den, Simple Hjelp har en tutorial på det, dekker svært grunnleggende bruk. Once you're comfortable with that, check out the [...] Når du er komfortabel med det, sjekk ut [...]

  2. Password-protect files in Linux « Linux & Stuff Passordbeskytte filer i Linux «Linux & Stuff linked to this post on July 1, 2009 knyttet til dette innlegget den 1 juli 2009

    [...] in CLI, password | Tags: CLI, password Here's a useful CLI to enable protecting special files in your system. [...] I CLI, passord | Tags: CLI, passord Her er en nyttig CLI å aktivere beskytte spesielle filer i systemet. To protect file.txt just run [...] For å beskytte file.txt bare kjøre [...]



Some HTML is OK Some HTML is OK

or, reply to this post via eller svare på dette innlegget via trackback styrekule . .