diff --git a/src/rtty.c b/src/rtty.c
index a250c95..98f5aa0 100755
--- a/src/rtty.c
+++ b/src/rtty.c
@@ -39,6 +39,7 @@
 #include "log/log.h"
 
 static char login_path[128];       /* /bin/login */
+static long nodata_time = 0;
 
 static void del_tty(struct tty *tty)
 {
@@ -194,7 +195,7 @@ static void tty_login(struct rtty *rtty, const char *sid)
 
     if (pid == 0) {
         if (rtty->username)
-            execl(login_path, "login", "-f", rtty->username, NULL);
+            execl(login_path, "login", "-f", rtty->username, "-p", NULL);
         else
             execl(login_path, "login", NULL);
 
@@ -294,6 +295,8 @@ void rtty_exit(struct rtty *rtty)
 {
     struct tty *tty, *ntty;
 
+    nodata_time = 0;
+
     if (rtty->sock < 0)
         return;
 
@@ -404,6 +407,7 @@ static int parse_msg(struct rtty *rtty)
     struct buffer *rb = &rtty->rb;
     int msgtype;
     int msglen;
+    struct sysinfo timeout = {};
 
     while (true) {
         if (buffer_length(rb) < 3)
@@ -440,6 +444,8 @@ static int parse_msg(struct rtty *rtty)
         case MSG_TYPE_WINSIZE:
         case MSG_TYPE_FILE:
         case MSG_TYPE_ACK:
+            sysinfo(&timeout);
+            nodata_time = timeout.uptime;
             parse_tty_msg(rtty, msgtype, msglen);
             break;
 
@@ -646,6 +652,16 @@ static void rtty_timer_cb(struct ev_loop *loop, struct ev_timer *w, int revents)
     struct rtty *rtty = container_of(w, struct rtty, tmr);
     ev_tstamp now = ev_now(loop);
 
+    if (0 != nodata_time) {
+        struct sysinfo timeout = {};
+        sysinfo(&timeout);		
+        if ((timeout.uptime - nodata_time) > RTTY_NO_DATA_TIMEOUT) {
+            log_err("Inactive 600 s, now exit rtty\n");
+            rtty_exit(rtty);
+            return;
+        }
+    }
+
     if (rtty->sock < 0) {
         if (now - rtty->active < 5)
             return;
@@ -657,7 +673,7 @@ static void rtty_timer_cb(struct ev_loop *loop, struct ev_timer *w, int revents)
 
     if (now - rtty->active > rtty->interval * 3 / 2) {
         log_err("Inactive too long time\n");
-        if (rtty->ninactive++ > 1) {
+        if (rtty->ninactive++ > 3) {
             log_err("Inactive 3 times, now exit\n");
             rtty_exit(rtty);
             return;
@@ -682,6 +698,8 @@ static void rtty_timer_cb(struct ev_loop *loop, struct ev_timer *w, int revents)
 
 int rtty_start(struct rtty *rtty)
 {
+    nodata_time = 0;
+    
     if (!rtty->devid) {
         log_err("you must specify an id for your device\n");
         return -1;
diff --git a/src/rtty.h b/src/rtty.h
index 758f71f..39f2ba4 100755
--- a/src/rtty.h
+++ b/src/rtty.h
@@ -42,6 +42,7 @@
 #define RTTY_HEARTBEAT_INTEVAL      5.0
 #define RTTY_TTY_TIMEOUT            600
 #define RTTY_TTY_ACK_BLOCK          4096
+#define RTTY_NO_DATA_TIMEOUT        600
 
 enum {
     MSG_TYPE_REGISTER,

