2
我有兩臺linux機器在運行。一個是jenkins服務器,另一個是燈服務器(從turnkey linux下載)。我需要允許jenkins服務器上的jenkins用戶使用NFS對燈服務器上的共享進行讀/寫許可。在jenkins服務器上使用root用戶可以正常工作,但是當通過jenkins運行時,當試圖將文件複製或刪除到燈服務器時,我總是會獲得權限被拒絕的錯誤。我嘗試了很多東西,但仍然失敗。我如何配置NFS以允許jenkins服務器上的jenkins用戶讀/寫/刪除到燈服務器上的NFS共享?允許非root用戶對nfs的權限份額
下面是我當前的配置信息:
Jenkins: 192.168.100.143
Lamp: 192.168.100.145
Lamp - /etc/exports
/var/www 192.168.100.143(rw,anonuid=33,anongid=33)
Lamp - /etc/passwd
www-data:x:33:33:www-data:/var/www:/bin/sh
[email protected] /var/www# ls -la
total 32
drwxr-xr-x 6 www-data www-data 4096 Oct 4 06:12 .
drwxr-xr-x 13 root root 4096 Oct 15 2013 ..
drwxr-xr-x 2 www-data www-data 4096 Oct 15 2013 cgi-bin
drwxr-xr-x 2 www-data www-data 4096 Oct 15 2013 css
drwxr-xr-x 2 www-data www-data 4096 Oct 15 2013 images
-rwxr-xr-x 1 www-data www-data 2709 Oct 15 2013 index.php
drwxr-xr-x 2 www-data www-data 4096 Oct 15 2013 js
-rwxr-xr-x 1 www-data www-data 20 Oct 15 2013 phpinfo.php
Jenkins - mount command:
mount -t nfs4 -o rw 192.168.100.145:/var/www /mnt/nfs/lamp
Jenkins - using root:
[email protected] nfs/lamp# ls -la
total 32
drwxr-xr-x 6 www-data www-data 4096 Oct 4 01:12 .
drwxr-xr-x 3 root root 4096 Oct 4 01:17 ..
drwxr-xr-x 2 www-data www-data 4096 Oct 15 2013 cgi-bin
drwxr-xr-x 2 www-data www-data 4096 Oct 15 2013 css
drwxr-xr-x 2 www-data www-data 4096 Oct 15 2013 images
-rwxr-xr-x 1 www-data www-data 2709 Oct 15 2013 index.php
drwxr-xr-x 2 www-data www-data 4096 Oct 15 2013 js
-rwxr-xr-x 1 www-data www-data 20 Oct 15 2013 phpinfo.php
[email protected] IDWEB-package/workspace# ls -la
total 6600
drwxr-xr-x 4 jenkins nogroup 4096 Oct 4 01:20 .
drwxr-xr-x 4 jenkins nogroup 4096 Oct 4 00:34 ..
drwxr-xr-x 6 jenkins nogroup 4096 Oct 4 00:34 .svn
-rw-r--r-- 1 jenkins nogroup 2262 Oct 4 00:34 build-package.xml
-rw-r--r-- 1 jenkins nogroup 6735944 Oct 4 00:34 idweb-package-43.zip
drwxr-xr-x 6 jenkins nogroup 4096 Oct 4 00:37 src
[email protected] IDWEB-package/workspace# cp idweb-package-43.zip /mnt/nfs/lamp
[email protected] IDWEB-package/workspace# sudo -u jenkins cp idweb-package-43.zip /mnt/nfs/lamp/idweb-package-43-2.zip
cp: cannot create regular file `/mnt/nfs/lamp/idweb-package-43-2.zip': Permission denied