How To Configure Home Directories Permission on Linux

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
Read more

Possibly Related Posts:


User Permission Overwrite Group Permissin on Linux

This is a tricky question when my customer ask me why he can’t change certain on his home folder.

Said for an example:
I have a username: john with primary group finance running on one of the Linux server.

$id john
uid=1008(john) gid=1002(finance) groups=1002(finance)

$pwd
/home/john

$ls -l aug2008.txt
-r-rw-r– 1 john finance 1168 2008-08-16 11.30 aug2008.txt

The problem is here:
When a user called john login to Linux box and he tried to edit file aug2008.txt using vi or any other editor, he will getting a READ ONLY error.
Read more

Possibly Related Posts:


← Previous Page

Planet Malaysia

  • Follow us on Twitter


  • web www.planetmy.com