Hi,

AFAIU ftpd just shares current working directory (unless given a path), no 
matter who logs in.
I find it useful to let ftpd chroot or cd to the home directory of a (non-root) 
user who logs in.
Please consider attached patch. I hope it won't ruin anybody's setup.

-- 
Aleksander Mazur
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -1295,8 +1295,14 @@
 	G.root_fd = -1;
 #endif
 	argv += optind;
-	if (argv[0]) {
-		const char *basedir = argv[0];
+	const char *basedir = argv[0];
+#if ENABLE_FEATURE_FTPD_AUTHENTICATION
+	if (!basedir && pw && pw->pw_uid) {
+		/* Non-root user logged in */
+		basedir = pw->pw_dir;
+	}
+#endif
+	if (basedir) {
 #if !BB_MMU
 		G.root_fd = xopen("/", O_RDONLY | O_DIRECTORY);
 		close_on_exec_on(G.root_fd);
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to