Having a strange problem with NFS share and file permissions on the 1 out of the 2 NFS clients, web1 has file permissions issues but web2 is fine. web1 and web2 are load balanced web servers.
So questions are:
- how do I ensure NFS share file contents retain the same permissions
for user/group as the original files on web1 server like they do on web2 server ?
- how do I reverse what I did on web1, i tried unmount command and said command not found ?
Information:
I'm using 3 dedicated server setup. All 3 servers CentOS 5.4 64bit based.
servers are as follows:
- web1 - nfs client with file permissions issues
- web2 - nfs client file permissions are OKAY
- db1 - nfs share at /nfsroot
web2 nfs client was setup by my web host, while web1 was setup by me.
I did the following commands on web1 and it worked with updating db1 nfsroot share at /nfsroot/site_css with latest files on web1 but the file permissions don't stick even if i use tar with -p command to perserve file permissions ?
cd /home/username/public_html/forums/script/
tar -zcp site_css/ > site_css.tar.gz
mount -t nfs4 nfsshareipaddress:/site_css /home/username/public_html/forums/scripts/site_css/ -o rw,soft
cd /home/username/public_html/forums/script/
tar -zxf site_css.tar.gz
But checking on web1 file permissions no longer username user/group but owned by nobody ? but web2 file permissions correct ? This is only a problem for web1 while web2 is correct ? Looks like numeric ids aren't the same ? Not sure how to correct this ?
web1 with incorrect user/group of nobody
ls -alh /home/username/public_html/forums/scripts/site_css
total 48K
drwxrwxrwx 2 nobody nobody 4.0K Feb 22 02:37 ./
drwxr-xr-x 3 username username 4.0K Feb 22 02:43 ../
-rw-r--r-- 1 nobody nobody 1 Nov 30 2006 index.html
-rw-r--r-- 1 nobody nobody 5.8K Feb 22 02:37 style-057c3df0-00011.css
-rw-r--r-- 1 nobody nobody 5.8K Feb 22 02:37 style-95001864-00002.css
-rw-r--r-- 1 nobody nobody 5.8K Feb 18 05:37 style-b1879ba7-00002.css
-rw-r--r-- 1 nobody nobody 5.8K Feb 18 05:37 style-cc2f96c9-00011.css
web1 numeric ids
ls -n /home/username/public_html/forums/scripts/site_css
total 48
drwxrwxrwx 2 99 99 4096 Feb 22 02:37 ./
drwxr-xr-x 3 503 500 4096 Feb 22 02:43 ../
-rw-r--r-- 1 99 99 1 Nov 30 2006 index.html
-rw-r--r-- 1 99 99 5876 Feb 22 02:37 style-057c3df0-00011.css
-rw-r--r-- 1 99 99 5877 Feb 22 02:37 style-95001864-00002.css
-rw-r--r-- 1 99 99 5877 Feb 18 05:37 style-b1879ba7-00002.css
-rw-r--r-- 1 99 99 5876 Feb 18 05:37 style-cc2f96c9-00011.css
web2 correct username user/group permissions
ls -alh /home/username/public_html/forums/scripts/site_css
total 48K
drwxrwxrwx 2 root root 4.0K Feb 22 02:37 ./
drwxr-xr-x 3 username username 4.0K Dec 2 14:51 ../
-rw-r--r-- 1 username username 1 Nov 30 2006 index.html
-rw-r--r-- 1 username username 5.8K Feb 22 02:37 style-057c3df0-00011.css
-rw-r--r-- 1 username username 5.8K Feb 22 02:37 style-95001864-00002.css
-rw-r--r-- 1 username username 5.8K Feb 18 05:37 style-b1879ba7-00002.css
-rw-r--r-- 1 username username 5.8K Feb 18 05:37 style-cc2f96c9-00011.css
web2 numeric ids
ls -n /home/username/public_html/forums/scripts/site_css
total 48
drwxrwxrwx 2 503 500 4096 Feb 22 02:37 ./
drwxr-xr-x 3 503 500 4096 Dec 2 14:51 ../
-rw-r--r-- 1 503 500 1 Nov 30 2006 index.html
-rw-r--r-- 1 503 500 5876 Feb 22 02:37 style-057c3df0-00011.css
-rw-r--r-- 1 503 500 5877 Feb 22 02:37 style-95001864-00002.css
-rw-r--r-- 1 503 500 5877 Feb 18 05:37 style-b1879ba7-00002.css
-rw-r--r-- 1 503 500 5876 Feb 18 05:37 style-cc2f96c9-00011.css
I checked db1 /nfsroot/site_css and user/group ownership was incorrect for newer files dated feb22 owned by root and not username ?
on db1 originally incorrect root assigned user/group for new feb22 dated files
ls -alh /nfsroot/site_css
total 44K
drwxrwxrwx 2 root root 4.0K Feb 22 02:37 .
drwxr-xr-x 17 root root 4.0K Feb 17 12:06 ..
-rw-r--r-- 1 root root 1 Nov 30 2006 index.html
-rw-r--r-- 1 root root 5.8K Feb 22 02:37 style-057c3df0-00011.css
-rw-r--r-- 1 root root 5.8K Feb 22 02:37 style-95001864-00002.css
-rw------- 1 username nfs 5.8K Feb 18 05:37 style-b1879ba7-00002.css
-rw------- 1 username nfs 5.8K Feb 18 05:37 style-cc2f96c9-00011.css
Then I chmod them all on db1 and chown to set to right ownership on db1 so it looks like below
on db1 once corrected the newer feb22 dated files
ls -alh /nfsroot/site_css
total 44K
drwxrwxrwx 2 root root 4.0K Feb 22 02:37 .
drwxr-xr-x 17 root root 4.0K Feb 17 12:06 ..
-rw-r--r-- 1 username username 1 Nov 30 2006 index.html
-rw-r--r-- 1 username username 5.8K Feb 22 02:37 style-057c3df0-00011.css
-rw-r--r-- 1 username username 5.8K Feb 22 02:37 style-95001864-00002.css
-rw-r--r-- 1 username username 5.8K Feb 18 05:37 style-b1879ba7-00002.css
-rw-r--r-- 1 username username 5.8K Feb 18 05:37 style-cc2f96c9-00011.css
but still web1 shows owned by nobody ? while web2 shows correct permissions ?
web1 still with incorrect user/group of nobody not matching what web2 and db1 are set to ?
ls -alh /home/username/public_html/forums/scripts/site_css
total 48K
drwxrwxrwx 2 nobody nobody 4.0K Feb 22 02:37 ./
drwxr-xr-x 3 username username 4.0K Feb 22 02:43 ../
-rw-r--r-- 1 nobody nobody 1 Nov 30 2006 index.html
-rw-r--r-- 1 nobody nobody 5.8K Feb 22 02:37 style-057c3df0-00011.css
-rw-r--r-- 1 nobody nobody 5.8K Feb 22 02:37 style-95001864-00002.css
-rw-r--r-- 1 nobody nobody 5.8K Feb 18 05:37 style-b1879ba7-00002.css
-rw-r--r-- 1 nobody nobody 5.8K Feb 18 05:37 style-cc2f96c9-00011.css
Just so confusing so any help is very very much appreciated!
thanks