chdir as root

psz at psz at
Tue Apr 5 04:09:45 GMT 2005

We are using Samba version 3.0.9 (about to upgade to 3.0.12) as a PDC with
Win2k and WinXP clients. Our logs always show something like

Apr  5 10:45:26 rome smbd[10892]: [2005/04/05 10:45:26, 0, pid=10892, effective(0, 0), real(0, 0)] smbd/service.c:set_current_service(51)  
Apr  5 10:45:26 rome smbd[10892]:   chdir (/users/psz) failed  

(In my limited testing of 3.0.12 I also got such messages.) I suspect the
explanation is that our home directories are NFS-mounted on the Samba
server, exported with default root_squash from a file server. The
directories mostly have mode 700, no "squashed root" (world) access.

I would like to suggest a patch along the following lines. This patch is
non-working (incomplete) because I do not know how to find if we are in
fact inside a become_root()/unbecome_root() bracket. Set/unset a global
flag within those routines?


Paul Szabo   psz at
School of Mathematics and Statistics   University of Sydney    Australia

--- smbd/vfs.c.orig	Sat Mar 19 01:56:41 2005
+++ smbd/vfs.c	Tue Apr  5 12:12:45 2005
@@ -660,6 +660,21 @@
 	DEBUG(4,("vfs_ChDir to %s\n",path));
 	res = SMB_VFS_CHDIR(conn,path);
+/* PSz  5 Apr 05 */
+#if 0
+	if (res && done_become_root) {
+ * We sometimes do this as root, while user (home?) directories are on NFS
+ * exported with default root_squash. Should become plain user, try again.
+ * Is there a way to find out if we are in the "become_root" state??
+ *
+ * Or, is it a bug that we ever try chdir while root?
+ */
+		unbecome_root();
+		res = SMB_VFS_CHDIR(conn,path);
+		become_root();
+	}
 	if (!res)

More information about the samba-technical mailing list