Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-24-2006, 06:49 AM   #1
Registered: Sep 2004
Location: Hyderabad
Posts: 440
Blog Entries: 1

Rep: Reputation: 30
Thumbs down password protect a directory in Linux

in windows, if i want i can passwd protect any directory which i need to restrict access to. Is there any such utility in linux?
I know file permissions can be used but still is there any utility
Old 05-24-2006, 07:23 AM   #2
Mega Man X
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65

You may want to take a look into The GNU Privacy Guard. You can easily protect files and directories with passwords like this:

$ gpg -c filename
Old 05-24-2006, 07:28 AM   #3
Registered: Jan 2006
Location: Vancouver BC
Distribution: LFS, SLak, Gentoo, Debian
Posts: 291

Rep: Reputation: 36
not that I have seen, using GROUP permissions is the usual way to control access to folders or files.
Old 05-24-2006, 07:52 AM   #4
Registered: Jul 2005
Posts: 109

Rep: Reputation: 15
Originally Posted by Mega Man X
You can easily protect files and directories with passwords like this:

$ gpg -c filename
That's actually a pretty groovy idea. How would you actually use the directories once encrypted though? Could it be done without decrypting them and creating a decrypted file?
Old 05-24-2006, 08:02 AM   #5
Registered: Oct 2005
Location: Australia
Distribution: slackware 12.1
Posts: 753

Rep: Reputation: 32
password protect from whom? if you are 'root' nobody can see your files. if you are a user nobody except 'root' can see your files (you can use chmod 700 on all your files) and even if you do find a program that lets you password protect your files, the 'root' may easily bypass them unless you encrypted them even so there is no guarantees.

remember 'root' is supreme, 'root' is GOD!
Old 05-24-2006, 08:46 AM   #6
Registered: Mar 2003
Location: Berkshire, England.
Distribution: SuSE 10.0
Posts: 299

Rep: Reputation: 32
If the person you want to protect the files from is logging in to the computer with a different user name, then it's easy -- just set the file permissions so that only the file owner can read it.
(setting file permissions -- command line: use the chmod command; in KDE: right-click on the file, and select 'permissions')

If the other person is logging in to the machine using the same login credentials as you, then you're missing all the fun: Linux is a fully multi-user system; each person can have their own log in, and once they're logged in, its like they've got the system to themselves -- they can then set up the environment just how they like it without interfering with anyone else's settings.

I guess it's just possible that you have two people using the same login, and you really don't want to have to change that (maybe you both share the same mailbox or something?). In that case, you're going to need to encrypt the files or something like that. You could log in as root and change the permissions to that only the root user can see the files, but that's not really what you should be using the root login for.

Hope that helps.
Old 05-24-2006, 03:20 PM   #7
Senior Member
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Linux has a great cryptography api built into the 2.6 kernel. This would probably be the most secure way to protects your files, even from root. I don't think even the NSA (or your countries equivalent) has the capability to crack a good twofish crypto scheme.

I used this guide to set it up on my own system.

Let me know if you need any help with it.


Last edited by drkstr; 05-24-2006 at 03:22 PM.


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 souvik Programming 3 11-06-2015 02:35 PM
Password protect a directory aquatux SUSE / openSUSE 6 08-02-2005 12:56 AM
How Can I password protect a sub-directory of a hosted website from client PC mark001 Linux - Newbie 18 11-12-2004 03:29 PM
How to password protect a web directory abdulber Linux - Software 1 01-28-2004 12:34 AM
Password protect a directory Stephanie Linux - General 6 03-26-2002 03:58 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:00 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration