Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LCS-primtux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Primtux-SLIS
LCS-primtux
Commits
78c44f11
Verified
Commit
78c44f11
authored
7 years ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
Script to delete users
parent
7b16123e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
delete_mass_primtux_users.sh
+63
-0
63 additions, 0 deletions
delete_mass_primtux_users.sh
with
63 additions
and
0 deletions
delete_mass_primtux_users.sh
0 → 100755
+
63
−
0
View file @
78c44f11
#!/bin/bash
# Copyright (C) 2018 Tetras Libre <Contact@Tetras-Libre.fr>
# Author: Beniamine, David <David.Beniamine@Tetras-Libre.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
usage
(){
echo
"Usage
$0
[uids.txt]"
echo
"Reads a list of name corresponding to some ldap users"
echo
"and remove each of them"
echo
"If the list is not specified, prompt for removing all Primtux users"
}
if
[
-z
"
$1
"
]
then
read
-p
"Do you actually want to remove all Primtux users [yes/No] ?"
ans
if
[
"
$ans
"
!=
"yes"
]
then
echo
"Aborting on user request"
usage
exit
1
fi
set
-x
file
=
"
$$
-uids.txt"
ldapsearch
-x
cn
=
Primtux |
awk
'/^memberUid/{print $2}'
>
$file
else
if
[
!
-f
"
$1
"
]
then
echo
"
$1
is not a file"
usage
exit
1
fi
file
=
"
$1
"
fi
rm
-f
uids.txt
scriptbinpath
=
"/usr/share/lcs/sbin"
if
[
!
-x
$scriptbinpath
/userDel.pl
]
then
echo
"Critical error :
$scriptbinpath
/userDel.pl does not exist or is not executable"
exit
1
fi
while
read
uid
do
echo
"Deleting user
$uid
"
$scriptbinpath
/userDel.pl
$uid
done
<
$file
#rm -f $$-uids.txt
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment