Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Hi This is my first post.I am learning Unix and finding it difficult to get a handle on the scripting side of things. Thanks in advance
I am running Ubuntu Server 12.04 on vmware player
The 1st task is create user accounts and groups from a csv file i'll only list 2 lines from csv to give you the idea
File name stud.csv id,firstname,surname,group,stage,status
Task For those students with status RE, create the account and
set the password to their StudentID.
o For those students with the status EL, create
the account without a password, and lock the
account
o Add each student to the group corresponding to
their class, i.e. DT228-4
o Add all students to the group student
o For each student with a d student number, add
them to the user group direct
o For each student with a c student number, add
them to the user group cao
with the help of several sites and a friend i managed to complete this part, its the next part i'm stuck on
Write and test bash script(s) to delete the accounts and any traces of the
accounts listed in the .csv file above. This includes
o the removal of the specified account
o the deletion of the user’s home directory
o the deletion of the user groups once all the
above accounts have been deleted
2. Relevant commands, code, scripts, algorithms:
The following is the script for the first part
[CODE]#!/bin/bash
while IFS=, read id firstname surname group stage status
do
3. The attempts at a solution (include all code and scripts):
This is what i tried. I just started with one group of users to see if that worked but no joy.
I tried a script from this forum titled Using userdel -r in a script? To delete multiple users.
but that didnt work either, but i think he was trying to delete users from a file, i want to delete them from the directory
Thanks again
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Dublin Institute Technology, Dublin, Ireland, Mark Deegan, DT768
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Last edited by dom17; 03-30-2014 at 09:56 AM..
Reason: correct code
for UserName in `cat users` ; do useradd -d /u02 -s /usr/libexec/openssh/sftp-server -G ftp-users $UserName ;
PassWord=$( echo $( tr '' '' <<< ${UserName:0:1} )${UserName:1} ) ;
echo "$PassWord@123" | passwd $UserName --stdin ; done
can some one explain what the bold text do
Please use... (5 Replies)
Hi Team,
Hope you are doing good.I am new to scripting.I have a requirement of deleting around 10 users in 100 servers.It is very time consuming by logging into each servers and delete the user.Here I have redhat 6 ,Suse linux 10&11 environment servers.
In one set of servers I have... (5 Replies)
Hello All,
The servers in question are AIX/Unix servers. I was hoping to find a scripting solution where I could use one server as a jump server and run a script that would check each server for a user account (the source file for the user accounts would be a text file or csv file) , and delete... (4 Replies)
Hi Experts,
I am new to scripting. We have around 400 Linux servers in our environment. I want to add a new user to a perticular group on all the servers using SSH.
Requirements:
1) Need to take the server names from a text file.
2) Login into each server and check whether perticular... (1 Reply)
hi,
i am new to shell scripts
i write a shell script to create multiple users but i need to give passwords to that users while creating users, command to write this script (1 Reply)
Requirement
Several files in remote machines ought to be deleted via sh. Name of the files to be deleted are know
Approach
1) script was written with ftp (requires credential) and delete command. File names were passed as array(iterated via for loop-with ftp+delete commands enclosed within... (1 Reply)
I'm getting ready to upgrade to Solaris 10 (from 8) and I'm trying to write a script that will delete approximately 800 user accounts that are no longer required. I'm trying to use the userdel -r command and read the input from a file with the list of user names. I've never been very good at... (3 Replies)
I am new to Linux and would appreciate some help. I need a script to do the following:
My file contains the following entries
more file
1
1
1
1
2
2
2
I want to delete multiple entries of 1 and 2 and just keep one of each. The output should look like
more file
1
2
Thanks (1 Reply)
its urgent!!!!!!111
i need a script which can delete data from multiple files.
plz if anybody knows the script plz write a mail to me :
(Email addresses are not allowed) (5 Replies)
Hello,
I am working with about 500,000 text files and 90% of them are duplicates. I need a way to delete the duplicate ones.
The files are email messages with the following file name examples:
20040129-1457 This is the Subject line.txt
20040129-1457 This is the Subject line-1.txt... (3 Replies)