In: Computer Science
You will have to experiment with using chmod on the
folder and the file to come up with the following:
Find the chmod commands for both the folder and the file that you
would use to give the minimum permissions for You (the owner) to be
able to edit and change the file (and I don’t want to see 777! ? )
:
___________________________________________________________
___________________________________________________________
___________________________________________________________
Answer
I believe you have some idea about the command chmod. Small recap of permissions.
U G O
rwx-rwx-rwx
Where
U - Is user/ owner
G - Group
2*2 2*1 1
4 2 1
i.e. 2 exp 0, 2 exp 1, 2 exp 2
In total max what you can have is 4 + 2 + 1 = 7
That means 7 = (Read + Write +
Execute)
e.g. chmod 777 means you are granting Read + Write + Execute to
Owner, Group and Others
Since you are looking for read and write for the owner - use
chmod 644 for files.
However, 644 will NOT work for
directory. Directory should have 7 (Read + Write +
Execute) for user or the owner but inside the directory,
owner can have only read and write permissons on the files. If you
provide 644 on the directory, the user/ owner will
NOT be able to access the directory as shown
below.
Hence for folder/ directory always have 755 set, inside which you can provide 644 for all the files. 644 means Read, Write for user/ owner, Read for Group and Others.
For directory
For files
Summary
For directory use this command - chmod 755 <directory_name>
For files use this command - chmod 644 * , where * indicates all the files residing in that directory