浏览代码

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

Kizureina 2 年之前
父节点
当前提交
c9101f440b
共有 1 个文件被更改,包括 6 次插入2 次删除
  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