473,386 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Changing Admins to standard users

347 100+
Is there a script that can be run to change a admin user to a standard user? I have a group of users who were given admin rights that don't need them and rather than do this manually, I'd prefer to do it with a script if at all possible.
Oct 14 '11 #1
1 7409
computerfox
276 100+
Try running this with sudo
Expand|Select|Wrap|Line Numbers
  1. #!/bin/python
  2. import os
  3. import sys
  4.  
  5. class editor:
  6.  path=None;
  7.  group=None;
  8.  users=None;
  9.  def __init__(self,path,group):
  10.   self.path=path;
  11.   self.group=group;
  12.   self.users=open(self.path).read().split("\n");
  13.  
  14.  def run(self):
  15.   i=0;
  16.   while i < len(self.users)-1:
  17.    print "Removing user " + self.users[i] + " from group " + self.group;
  18.    os.system("dseditgroup -o edit -d " + self.users[i] + " -t user " + self.group);
  19.    i+=1;
  20. if len(sys.argv) < 3:
  21.  print "Please provide filepath and group to remove from...";
  22. else:
  23.  session=editor(sys.argv[1],sys.argv[2]);
  24.  session.run();
  25. print "\n";
  26.  
http://safe.abelgancsos.com/codepost...ect.php?id=386

Hope that helps!
May 21 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: newsgroupsYOUKNOWWHATTODO | last post by:
Hi Folks, I've been contemplating two things for a php project I'm working on : 1) doing user security stuff (users, admins, super-admins etc), pref. compatible with win32 2) doing...
0
by: Tony | last post by:
We are a software company that builds an ASP.Net web application which implements cookieless sessionState with SQLServer- the session is stored in the url. Our ASPState database has been built...
88
by: Matt | last post by:
Hi folks. Can you help with some questions? I gather that some types supported by g++ are nonstandard but have been proposed as standards. Are the long long and unsigned long long types still...
0
by: Steve | last post by:
Some of my power users create their own SQL Agent jobs. All well and good. However, I don't wish to give them System Administrator privileges, and when they create their jobs, the check box to...
3
by: MLH | last post by:
I was running the following code while logged in as a user belonging only to the Users group. Set usrNew = .CreateUser(Me!UserID) 'The user ID is in a control on the form usrNew.PID =...
6
by: Larry | last post by:
After installing VisualC# Standard, DX9 will not install the debugger. Any other users of C# Standard have similar problems? PS: I ran the complete VStudio .net trial for 60 days and DX9...
1
by: Daniel Passwater via DotNetMonster.com | last post by:
I'm working on a app that displays according to a registry key value. The user needs the ability to update the display, and hense the registry key (via a click event on a popup menu). This all...
6
by: google | last post by:
I have a few general questions. I am working on a new database to be used within my company. I would like to give a couple of people, particularly HR, the ability to add and delete Access users,...
6
by: Jan | last post by:
Hi: I have created a secured database for a client. For various reasons, I don't want the client to have full persmissions for the database; they aren't in the admins group. I have instead tried...
3
by: sbaird | last post by:
Aloha from Hawaii, I'm beating my head on the wall here. I have a recruiting contact managment database I'm trying to create. Managers (there ar 14 of them) have to make a certain number of...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.