diff --git a/ChangeLog b/ChangeLog
index 982fb60e43c191050ab95a444ec3ceb27f805253..ebd253f3745a232363cfcd46d3231dfde37b88ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 
 	* Released lsh-1.4.3.
 
+	* src/server_pty.c (pty_open_slave): Removed call to setsid(),
+	moved to...
+	* src/unix_user.c (do_spawn): Call setsid(). Was previously done by
+	the pty code, and only in the pty case. Fix backported from lsh-1.5.
+
 	* misc/mkdiff: Copied the script from the old lsh_1_2_BRANCH.
 
 2003-09-19  Niels M�ller  <niels@s3.kth.se>
diff --git a/NEWS b/NEWS
index 39c4fbc36a55816d1265a0fc0ecb55a0de60b8da..d4181ca1de86845c3f4da2e8f22cd86dbae7612f 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ News for the 1.4.3 release
 	failure in the handling of channel_open, and in the
 	experimental client SRP code.
 
+	Backported lshd setsid fix from lsh-1.5. Should call setsid
+	both in the pty and non-pty cases.
+	
 	Updated the code to compile with automake-1.7.3 and
 	scsh-0.6.0. 
 
diff --git a/src/server_pty.c b/src/server_pty.c
index 462116fd06f48936742d4f43bf438fbb25a8cdad..6f4128b46a7ba6cf67496f27dcb121ddf1ddd0ae 100644
--- a/src/server_pty.c
+++ b/src/server_pty.c
@@ -257,12 +257,6 @@ pty_open_slave(struct pty_info *pty)
   int fd;
   
   trace("pty_open_slave\n");
-  if (setsid() < 0)
-    {
-      werror("tty_setctty: setsid failed, already process group leader?\n"
-	     "   (errno = %i): %z\n", errno, STRERROR(errno));
-      return -1;
-    }
 
   /* Open the slave. On Sys V, that also makes it our controlling tty. */
   fd = open(lsh_get_cstring(pty->tty_name), O_RDWR);
diff --git a/src/unix_user.c b/src/unix_user.c
index ea17f09bf0e0ec70c94bc5be4bd166900bc2f959..7c26db1995c6c242ae1becb515c317173652beb9 100644
--- a/src/unix_user.c
+++ b/src/unix_user.c
@@ -813,6 +813,14 @@ do_spawn(struct lsh_user *u,
 
       trace("do_spawn: child after chdir\n");
       
+      /* We want to be a process group leader */
+      if (setsid() < 0)
+	{
+	  werror("unix_user: setsid failed, already process group leader?\n"
+		 "   %e\n", errno);
+	  _exit(EXIT_FAILURE);
+	}
+
 #if WITH_PTY_SUPPORT
       if (info->pty)
 	{