Browse Source

Add a judgment on whether the tomcat-user can be logged in

Kizureina 2 years ago
parent
commit
c9101f440b
1 changed files with 6 additions and 2 deletions
  1. 6 2
      init.d/Tomcat-init

+ 6 - 2
init.d/Tomcat-init

@@ -86,8 +86,12 @@ stop() {
 }
 
 user_exists() {
-  if id -u $1 >/dev/null 2>&1; then
-    echo "1"
+  if [ "`cat /etc/passwd | grep ftp | cut -d ":" -f7 | cut -d "/" -f4`" = "nologin" ]; then
+    if id -u $1 >/dev/null 2>&1; then
+      echo "1"
+    else
+      echo "0"
+    fi
   else
     echo "0"
   fi