|
sed -i \"s/\$Containeruser//g ; s/:,/:/g ; s/,\$//g\" /etc/group # remove existing entries for user in /etc/group |
echo "# /etc/group /etc/gshadow
sed -i \"s/\$Containeruser//g ; s/:,/:/g ; s/,\$//g\" /etc/group # remove existing entries for user in /etc/group
sed -i \"s/\$Containeruser//g ; s/:,/:/g ; s/,\$//g\" /etc/gshadow # remove existing entries for user in /etc/gshadow
"
prints
# /etc/group /etc/gshadow
sed -i "s/$Containeruser//g ; s/:,/:/g ; s/,$//g" /etc/group # remove existing entries for user in /etc/group
sed -i "s/$Containeruser//g ; s/:,/:/g ; s/,$//g" /etc/gshadow # remove existing entries for user in /etc/gshadow
The format of /etc/group is groupName:password:GID:user1,user2,user3
- The first pattern removes "$Containeruser". The pattern is not anchored. It will remove it from groupName or any other users name.
- When the username removed correctly, we can have a surrounding of the hole:
:$ (sole user), :, (first user) ,, (middle user) and ,$ (last user)
sole user needs no correction. first user and last user are handled. middle user is not.
The format of /etc/gshadow is groupName:password:admin1,admin2,admin3:user1,user2,user3
I assume we also want to remove the username from the admin positions
This yields some new possible surroundings: :: (sole admin), ,: (last admin)
We still need to anchor "$Containeruser"
x11docker/x11docker
Line 8963 in e22c320
prints
The format of /etc/group is
groupName:password:GID:user1,user2,user3:$(sole user),:,(first user),,(middle user) and,$(last user)sole user needs no correction. first user and last user are handled. middle user is not.
The format of /etc/gshadow is
groupName:password:admin1,admin2,admin3:user1,user2,user3I assume we also want to remove the username from the admin positions
This yields some new possible surroundings:
::(sole admin),,:(last admin)We still need to anchor "$Containeruser"