Find the answer to your Linux question:
Results 1 to 8 of 8
ok so another brick wall where my windows experience is trying to take over solutions to linux problems (i know... im trying to stop) basically i want to put a ...
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    21

    Red face [SOLVED] Password directories

    ok so another brick wall where my windows experience is trying to take over solutions to linux problems (i know... im trying to stop)

    basically i want to put a password onto a folder i have. i realise that the only way to do this in windows (sorry for swearing) is o create a .zip or .rar archive and in the options you can set a password. however the .gz and .tar compressions seem to work differently and i cant find any GUI (i think thats right :S) software to put a lock on the archive....

    any ideas will be much appreciated

  2. #2
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    1,946
    I assume you have some reason other than limiting access which could be done by chmod 700 filename, giving only root access. Here's a link that purports to show how to do this on Ubuntu:

    How to password protect a folder on Linux? - Ubuntu Forums

    It requires you to download several packages. Haven't tried it myself and not sure if this will do what you want?

    That probably won't help, forgot I was under Suse forums. I did some googling and didn't find much, most links I found were for compressing a folder into a password protected zip file.
    Last edited by yancek; 08-09-2010 at 11:32 PM. Reason: Add'l Info

  3. #3
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    665
    something you could do that is FAR more secure than password protecting folders, is to tar.gz them, and then encrypt them with GnuPG. The only problem here, is that if you lose the encryption key, you lose the file. It may not work for you, but it's just a suggestion.
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    Closest distro at hand for me at the moment is Ubuntu 10.04. I just fired up the default zip-handler (GNOME's File Roller V. 2.30.1.1) and see that it has a password option.

    Right-click > Compress > Other Options > Password

  5. #5
    Linux Guru gogalthorp's Avatar
    Join Date
    Oct 2006
    Location
    West (by God) Virginia
    Posts
    3,105

  6. #6
    Just Joined!
    Join Date
    May 2010
    Posts
    21
    ok so .gpg looks like the way to go...

    ive compresses a test.tar.gz and used the command line

    Code:
    gpg -e test.tar.gz
    then i get the password option which i type in and confirm.

    then i get the 'test.tar.gz.gpg' file in the directry....

    all looks good untill i click on the 'test.tar.gz.gpg' and im not asked for a password... it just remakes the 'test.tar.gz' folder for every one to see

    ive got a feeling that its because its on my user account so i tried making it as a root user but still no luck any ideas?

    excellent information by the way... its convinced me to use command lines more often

  7. #7
    Just Joined!
    Join Date
    May 2010
    Posts
    21
    now i cant seem to make the .gpg at all

    my login is Tilley. name is Daniel Tilley and my UID is 1000
    but i cant seem to use any of them, or for that mater, -r.

    Code:
    Tilley@linux-lnlh:~/Pictures> gpg -e test.tar.gz
    You did not specify a user ID. (you may use "-r")
    
    Current recipients:
    
    Enter the user ID.  End with an empty line: -r
    No such user ID.

  8. #8
    Just Joined!
    Join Date
    May 2010
    Posts
    21
    ok ive managed it. heres for any one who would like to do the same.

    first compress your folder into .tar.gz

    your going to be using a Key which can be done either in Kgpg or in the terminal.

    to use the terminal use

    Code:
    gpg --gen-key
    follow the instructions

    then once the key is made, make sure its there

    Code:
    gpg --list-keys
    (i had to delete a key)

    once you have your key with a password you need to assign it tou your .tar.gz file..

    Code:
    gpg -c -r 'name of key (Daniel)' test.tar.gz
    then check you have your .gpg file in your directory and delete the old .tar.gz folder any way you choose.

    now click on the .gpg file and test the password..... worked a treat for me thankyou for all the help

    Thankyou to gogalthorp for recommending the sight to me (i cannot post urls yet haha).

    heres my bash code to see how it worked

    Code:
    Tilley@linux-lnlh:~/Pictures> gpg --gen-key
    gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
    This is free software: you are free to change and redistribute it.   
    There is NO WARRANTY, to the extent permitted by law.                
    
    Please select what kind of key you want:
       (1) RSA and RSA (default)            
       (2) DSA and Elgamal                  
       (3) DSA (sign only)                  
       (4) RSA (sign only)                  
    Your selection? 1                       
    RSA keys may be between 1024 and 4096 bits long.
    What keysize do you want? (2048)                
    Requested keysize is 2048 bits                  
    Please specify how long the key should be valid.
             0 = key does not expire                
          <n>  = key expires in n days              
          <n>w = key expires in n weeks             
          <n>m = key expires in n months            
          <n>y = key expires in n years             
    Key is valid for? (0) 0                         
    Key does not expire at all                      
    Is this correct? (y/N) y                        
    
    GnuPG needs to construct a user ID to identify your key.
    
    Real name: Daniel
    Email address: Tilley@email.com
    Comment: for test                  
    You selected this USER-ID:         
        "Daniel (for test) <Tilley@email.com>"
    
    Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? 0
    Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
    You need a Passphrase to protect your secret key.    
    
    We need to generate a lot of random bytes. It is a good idea to perform
    some other action (type on the keyboard, move the mouse, utilize the   
    disks) during the prime generation; this gives the random number       
    generator a better chance to gain enough entropy.                      
    
    We need to generate a lot of random bytes. It is a good idea to perform
    some other action (type on the keyboard, move the mouse, utilize the   
    disks) during the prime generation; this gives the random number       
    generator a better chance to gain enough entropy.                      
    gpg: key E8CC879E marked as ultimately trusted                         
    public and secret key created and signed.                              
    
    gpg: checking the trustdb
    gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
    gpg: depth: 0  valid:   2  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 2u
    pub   2048R/E8CC879E 2010-08-10                                      
          Key fingerprint = CF6B D82C B5C5 CBEF 4E7C  24BE 05EB 3D96 E8CC 879E
    uid                  Daniel (for test) <Tilley@email.com>             
    sub   2048R/0898FD62 2010-08-10                                           
    
    Tilley@linux-lnlh:~/Pictures> 
    Tilley@linux-lnlh:~/Pictures> gpg --list-keys
    /home/Tilley/.gnupg/pubring.gpg              
    -------------------------------              
    pub   1024R/C5058CF6 2010-08-10              
    uid                  Daniel (for pics) <tilley@email.com>
    sub   1024R/94EC100C 2010-08-10                              
    
    pub   2048R/E8CC879E 2010-08-10
    uid                  Daniel (for test) <Tilley@email.com>
    sub   2048R/0898FD62 2010-08-10                              
    
    Tilley@linux-lnlh:~/Pictures> gpg --delete-secret-key C5058CF6
    gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    
    sec  1024R/C5058CF6 2010-08-10 Daniel (for pics) <tilley@email.com>
    
    Delete this key from the keyring? (y/N) y
    This is a secret key! - really delete? (y/N) y
    Tilley@linux-lnlh:~/Pictures> gpg --delete-key C5058CF6
    gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    
    pub  1024R/C5058CF6 2010-08-10 Daniel (for pics) <tilley@email.com>
    
    Delete this key from the keyring? (y/N) y
    Tilley@linux-lnlh:~/Pictures> gpg --list-keys
    gpg: checking the trustdb
    gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
    gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
    /home/Tilley/.gnupg/pubring.gpg
    -------------------------------
    pub   2048R/E8CC879E 2010-08-10
    uid                  Daniel (for test) <Tilley@email.com>
    sub   2048R/0898FD62 2010-08-10
    
    Tilley@linux-lnlh:~/Pictures> gpg -c -r 'Daniel' test.tar.gz
    gpg: WARNING: recipients (-r) given without using public key encryption
    Tilley@linux-lnlh:~/Pictures>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...