Password protecting a directory

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Password protecting a directory
# 1  
Old 07-30-2009
Password protecting a directory


Is there a way to password protect a dir in linux ??

I need to protect the tmp folder of a JBoss server instance running on Linux RedHat os.

I cannot change permissions cause, the root password is shared and a number of people login via that.

also if possible can i restrict the root user from accessing a dir location , i.e can i restrict access to the dir "test" , hence stop "cd /root/temp/test". test may be accessible by providing a password/passphrase.


Last edited by akshay61286; 07-30-2009 at 03:04 AM..
# 2  
Old 07-30-2009
Sorry, no. There is no way to password protect a directory in Linux in the way you describe.

My recommendation is to work towards restricting root access to only those who absolutely need it, and use sudo to allow those who need root access to execute those commands that they need. This would, of course, be a long term process but it would ultimately improve your security.
# 3  
Old 07-30-2009
You cannot prevent root from accessing anything ever. Hence, giving out the root password to a lot of people is a really bad idea.

Your best hope is encryption. There are encrypted filesystems like eCryptfs. Rather than explain it try reading:
How to set up an encrypted filesystem in several easy steps

You can also encrypt the individual files in the directory itself if you want.

Decryption requires a password.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Password Protecting a File

Hi Guys, I am generating a csv file using a shell script in Unix. Please can you guys advise if I can also password protect the file. Best Regards, Shaz (5 Replies)
Discussion started by: Shazin
5 Replies

2. AIX

Protecting backup with password

Hello AIX experts, How can I protect my backups using password? I'm waiting any solution. Thanks (2 Replies)
Discussion started by: Mohannad
2 Replies

3. Shell Programming and Scripting

How do i set a password to a directory?

A situation where i need to create 10 directories and set its 10 passwords. Since each of the directories contents would be critical, only few users need to access. :wall: I need to write a script so that it creates 10 directories in no time. So, how can i explicitly set a password to a... (1 Reply)
Discussion started by: Manjunath B
1 Replies

4. Shell Programming and Scripting

Password protecting a Excel file.

Hi, I want to make Excel files password protected present in my Unix directory. I have a application which will basically invoke a shell script with a parameter passed. The purpose of shell script would be to pop up a box to enter password. This password will be validated against database entry... (1 Reply)
Discussion started by: anil029
1 Replies

5. Shell Programming and Scripting

Password Protecting a File

hello there. Is there a way to password protect a file and make it so that several passwords can open it? i'm trying to write a script that open up a file if the password given by a user is one of many other passwords in the database of the file. not sure if this is possible. thanks the... (2 Replies)
Discussion started by: SkySmart
2 Replies

6. UNIX for Dummies Questions & Answers

Protecting a folder/directory against root access.

A friend and I run a vbulletin forum which recently got hacked. We believe what wound up happening was the attacker gained access to the VPS box and from there elevated their user accounts to admin status on our forums. Obviously if someone gets into our box in the future it'll be a disaster so... (1 Reply)
Discussion started by: fannypack
1 Replies

7. UNIX for Dummies Questions & Answers

Protecting the directory tree

Hello, I am hoping someone maybe able to help me. I have set up an Apache web server on my sun server with user accounts in the main htdocs directory. My question is how to stop these users searching up the directory tree when they ftp/telnet to the server. Also is it possible to restrict the... (2 Replies)
Discussion started by: rooneyl
2 Replies

8. Solaris

Password Protecting Directories...

Hi all, Just out of interest does anyone know how to password protect directories in Solaris? I have had a google search but just got a load of info about how to do it for webservers and apache, it needs to be Operating System level. Had a look on the Sun site as well but couldn't find... (1 Reply)
Discussion started by: B14speedfreak
1 Replies

9. UNIX for Dummies Questions & Answers

password protecting a directory

I need to password protect a particular file on one of my websites. Is it possible to password protect the entire directory? Or can I only password protect one file. How do I do this? Does it have to do with the .HTACCESS file on my unix server? Please Help! ~ :confused: ~ (2 Replies)
Discussion started by: iriemember
2 Replies
Login or Register to Ask a Question