How To Configure Home Directories Permission on Linux

Tags: , , , ,

In order to change all home directory permission, I will run the following script:


for DIR in \
`awk -F: '($3 >= 500) { print $6 }' /etc/passwd`; do
chmod g-w $DIR
chmod o-rwx $DIR
done

Basically the script as above will remove WRITE permission for group, remove READ, WRITE, EXECUTE for other for any user ID larger than 500 on Linux.

List the directory again and the result should be same as below:
sles9:/home # ls -lth
total 60K
drwxr-x— 7 test users 4.0K Nov 29 2008 test
drwxr-x— 7 test1 users 4.0K Nov 25 2008 test1
drwxr-x— 7 dell users 4.0K Sep 7 2008 dell
drwxr-x— 7 test2 users 4.0K Aug 18 11:52 test2

Done!

Possibly Related Posts:


Leave a Reply