4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 . $(dirname "$0")/utils.sh
21 set -- "/sbin/nologin" "/bin/sync" "/sbin/halt" "/sbin/shutdown"
24 if [ "$no_login_shell" = "$shell" ]
32 set_nologin_shell () {
35 name=$(echo "$account" | cut -d: -f1)
36 uid=$(echo "$account" | cut -d: -f3)
37 gid=$(echo "$account" | cut -d: -f4)
38 gecos=$(echo "$account" | cut -d: -f5)
39 home_dir=$(echo "$account" | cut -d: -f6)
41 del_user "$name" > /dev/null 2&>1
42 group_name=$(get_group_name "$gid")
47 group_command="-G $group_name"
49 adduser -D -h "$home_dir" -g "$gecos" -s /sbin/nologin $group_command -u "$uid" "$name"
56 name=$(echo "$account" | cut -d: -f1)
57 if [ "$name" = "root" ]
62 shell=$(echo "$account" | cut -d: -f7)
63 if is_nologin_shell "$shell"
65 set_nologin_shell "$account"
69 if [[ `ls -ld /root | awk '{print $3"\n"$4}' | grep -v root` ]]