diff --git a/sshd.c b/sshd.c
index df76dc78c..c6041cfae 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1215,7 +1215,8 @@ main(int ac, char **av)
 	saved_argc = ac;
 	rexec_argc = ac;
 	saved_argv = xcalloc(ac + 1, sizeof(*saved_argv));
-	for (i = 0; (int)i < ac; i++)
+	saved_argv[0] = xstrdup("@TERMUX_PREFIX@/bin/sshd");
+	for (i = 1; (int)i < ac; i++)
 		saved_argv[i] = xstrdup(av[i]);
 	saved_argv[i] = NULL;
 
@@ -1224,10 +1225,10 @@ main(int ac, char **av)
 	compat_init_setproctitle(ac, av);
 	av = saved_argv;
 #endif
-
+#ifndef __ANDROID__
 	if (geteuid() == 0 && setgroups(0, NULL) == -1)
 		debug("setgroups(): %.200s", strerror(errno));
-
+#endif
 	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
 	sanitise_stdfd();
 
@@ -1348,9 +1349,10 @@ main(int ac, char **av)
 			break;
 		}
 	}
+#ifndef __ANDROID__
 	if (!test_flag && !inetd_flag && !do_dump_cfg && !path_absolute(av[0]))
 		fatal("sshd requires execution with an absolute path");
-
+#endif
 	closefrom(STDERR_FILENO + 1);
 
 	/* Reserve fds we'll need later for reexec things */
@@ -1609,12 +1611,13 @@ main(int ac, char **av)
 	/* Ensure privsep directory is correctly configured. */
 	need_chroot = ((getuid() == 0 || geteuid() == 0) ||
 	    options.kerberos_authentication);
+#ifndef __ANDROID__
 	if ((getpwnam(SSH_PRIVSEP_USER)) == NULL && need_chroot) {
 		fatal("Privilege separation user %s does not exist",
 		    SSH_PRIVSEP_USER);
 	}
 	endpwent();
-
+#endif
 	if (need_chroot) {
 		if ((stat(_PATH_PRIVSEP_CHROOT_DIR, &sb) == -1) ||
 		    (S_ISDIR(sb.st_mode) == 0))
@@ -1645,9 +1648,10 @@ main(int ac, char **av)
 	 * to create a file, and we can't control the code in every
 	 * module which might be used).
 	 */
+#ifndef __ANDROID__
 	if (setgroups(0, NULL) < 0)
 		debug("setgroups() failed: %.200s", strerror(errno));
-
+#endif
 	/* Prepare arguments for sshd-session */
 	if (rexec_argc < 0)
 		fatal("rexec_argc %d < 0", rexec_argc);
@@ -1686,7 +1690,7 @@ main(int ac, char **av)
 	already_daemon = daemonized();
 	if (!(debug_flag || inetd_flag || no_daemon_flag || already_daemon)) {
 
-		if (daemon(0, 0) == -1)
+		if (daemon(1, 0) == -1)
 			fatal("daemon() failed: %.200s", strerror(errno));
 
 		disconnect_controlling_tty();
@@ -1698,9 +1702,10 @@ main(int ac, char **av)
 	 * Chdir to the root directory so that the current disk can be
 	 * unmounted if desired.
 	 */
+#ifndef __ANDROID__
 	if (chdir("/") == -1)
 		error("chdir(\"/\"): %s", strerror(errno));
-
+#endif
 	/* ignore SIGPIPE */
 	ssh_signal(SIGPIPE, SIG_IGN);
 
