Parcourir la source

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

Kizureina il y a 2 ans
Parent
commit
c9101f440b
1 fichiers modifiés avec 6 ajouts et 2 suppressions
  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