different file and folder permissions

NeghVar

2[H]4U
Joined
May 1, 2003
Messages
2,671
I have an Ubuntu-base Linux OS and I need to set certain permissions for a folder and its files. I need to set the folder as RW but the files as R. So, I want to copy, move or create files in the folder, but the files themselves need to be read only (except for root access). I know the chmod command, but based on what I have read, it seems to set permissions for both the folder and the files within it. Any advice?
 
Are you wanting to have the default permissions when you create a new file in the directory different than what the directory has? Is that what you are asking?


For the current folder & files you can change the folder first, then go in and change the files next.

chmod 640 directoryx
cd directoryx
chmod 440 *.*

Or if you are wanting it so only you can read and write, it would be

chmod 600 directoryx
cd directoryx
chmod 400 *.*
 
Thanks. It is for a system to store dd hard drive images for forensic analysis.
 
What I posted works the first time, but when you add new files to the directory, I don't know that they will default to 440 or 400.
 
You generally need execute permissions on directories so be sure to use 750 or 700 or 755.
 
Back
Top