Sponsored Content
Top Forums Shell Programming and Scripting Shell script for creating multiple users with password Post 302970751 by James0806 on Monday 11th of April 2016 03:01:26 PM
Old 04-11-2016
Shell script for creating multiple users with password

Code:
for UserName in `cat users` ; do useradd -d /u02 -s /usr/libexec/openssh/sftp-server -G ftp-users $UserName ; 
PassWord=$( echo $( tr '[:lower:]' '[:upper:]' <<< ${UserName:0:1} )${UserName:1} ) ; 
echo "$PassWord@123" | passwd $UserName --stdin ; done

can some one explain what the bold text do
Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, output, and code segments.

Last edited by Don Cragun; 04-11-2016 at 04:14 PM.. Reason: Add CODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with shell script - creating users

echo -e "Enter in a username : \c" read username grep "^$username:" /etc/passwdWhat I'm trying to do is take in a username from my script and I need to be able to check if that username already exists. If it does the script should display a message saying that the user already exists and exit. ... (2 Replies)
Discussion started by: shadowcat
2 Replies

2. BSD

Creating an array out of users: shell script

I want to create a shell script for a menu selection consisting of users defined on the machine. To an administrator having the privileges, the selection menu will look as follows: Select the user you want to define the variables for: 1) my-username-1 2) my-username-2 etc Then there would be a... (7 Replies)
Discussion started by: figaro
7 Replies

3. Shell Programming and Scripting

creating multiple sub-/directories using a shell script

0 Hi, I am looking for a way of creating multiple directories using the mkdir -p command in a shell script. I'm working with an Ubuntu machine and try to do something like that: #!/bin/sh ... (3 Replies)
Discussion started by: frymor
3 Replies

4. Shell Programming and Scripting

Shell script to change the password on multiple servers in linux

Can any one please let me know the shell script to change the password for a particular user on multiple linux servers. (2 Replies)
Discussion started by: s_madras
2 Replies

5. Shell Programming and Scripting

Script in bash wchich creating a new users...

Hi, I am a new on this forum but i like :) I need a script in bash which will be crating a new user with folder for websites. For example: I will run this program and he creating a new user(with my name) and folder whcich name like user and if i will localho/~user in browser, she show me files from... (1 Reply)
Discussion started by: puclavv
1 Replies

6. UNIX for Dummies Questions & Answers

Script for creating users

Hi, I wants to create the users for multiple machine from single main server using the shell script ,can you please help me on this.... (2 Replies)
Discussion started by: Rahulne25
2 Replies

7. Shell Programming and Scripting

Writing a script on creating and comparing users

Hello Everybody i am a newbie to the bash scripting.please can someone help me out here.i want to write a script on creating 10 users with passwords and comparing the users to the ones in /etc/passwd file.am i gonna use arrays in creating the 10 users or what?and again, how do i compare both... (1 Reply)
Discussion started by: bruno_brunt
1 Replies

8. Shell Programming and Scripting

Creating new users using a text file as imput (using only shell script and/or awk)

I need somebody who could help with an exercise. You have a text file called users.txt with this info inside: users.txt: user1:1234:/home/homedir1 ; user2:1234:/home/homedir2 ; user3:1234:/home/homedir3 ; user4:1234:/home/homedir4 ; The script should create an user using the... (2 Replies)
Discussion started by: marcosruiz
2 Replies

9. Red Hat

Script for Creating more users like 50 in one server

Hi friends could you please share me the script to create more users in one server except newusers, is there any option to change secondary group and how to print passwd and changing the age all these things how can i edit in newsers.. please help me (0 Replies)
Discussion started by: indiankrish
0 Replies

10. HP-UX

Creating a group of users with script

Hi, I have a file with usernames, and the comment section, e.g : Data removed by request of sanchitadutta91, 20 May 2020 I need to add these users into a server. Is it possible to use a script to create the users, together with the comment ? From the commandline to add one user, the... (2 Replies)
Discussion started by: anaigini45
2 Replies
mod_auth(3erl)						     Erlang Module Definition						    mod_auth(3erl)

NAME
mod_auth - User authentication using text files, dets or mnesia database. DESCRIPTION
This module provides for basic user authentication using textual files, dets databases as well as mnesia databases. EXPORTS
add_user(UserName, Options) -> true| {error, Reason} add_user(UserName, Password, UserData, Port, Dir) -> true | {error, Reason} add_user(UserName, Password, UserData, Address, Port, Dir) -> true | {error, Reason} Types UserName = string() Options = [Option] Option = {password,Password} | {userData,UserData} | {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPass- word} Password = string() UserData = term() Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() AuthPassword =string() Reason = term() add_user/2, add_user/5 and add_user/6 adds a user to the user database. If the operation is successful, this function returns true . If an error occurs, {error,Reason} is returned. When add_user/2 is called the Password, UserData Port and Dir options is mandatory. delete_user(UserName,Options) -> true | {error, Reason} delete_user(UserName, Port, Dir) -> true | {error, Reason} delete_user(UserName, Address, Port, Dir) -> true | {error, Reason} Types UserName = string() Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() AuthPassword = string() Reason = term() delete_user/2, delete_user/3 and delete_user/4 deletes a user from the user database. If the operation is succesfull, this function returns true . If an error occurs, {error,Reason} is returned. When delete_user/2 is called the Port and Dir options are mandatory. get_user(UserName,Options) -> {ok, #httpd_user} |{error, Reason} get_user(UserName, Port, Dir) -> {ok, #httpd_user} | {error, Reason} get_user(UserName, Address, Port, Dir) -> {ok, #httpd_user} | {error, Reason} Types UserName = string() Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() AuthPassword = string() Reason = term() get_user/2, get_user/3 and get_user/4 returns a httpd_user record containing the userdata for a specific user. If the user cannot be found, {error, Reason} is returned. When get_user/2 is called the Port and Dir options are mandatory. list_users(Options) -> {ok, Users} | {error, Reason} list_users(Port, Dir) -> {ok, Users} | {error, Reason} list_users(Address, Port, Dir) -> {ok, Users} | {error, Reason} Types Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() Users = list() AuthPassword = string() Reason = atom() list_users/1, list_users/2 and list_users/3 returns a list of users in the user database for a specific Port/Dir . When list_users/1 is called the Port and Dir options are mandatory. add_group_member(GroupName, UserName, Options) -> true | {error, Reason} add_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason} add_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason} Types GroupName = string() UserName = string() Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() AuthPassword = string() Reason = term() add_group_member/3, add_group_member/4 and add_group_member/5 adds a user to a group. If the group does not exist, it is created and the user is added to the group. Upon successful operation, this function returns true . When add_group_members/3 is called the Port and Dir options are mandatory. delete_group_member(GroupName, UserName, Options) -> true | {error, Reason} delete_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason} delete_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason} Types GroupName = string() UserName = string() Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() AuthPassword = string() Reason = term() delete_group_member/3, delete_group_member/4 and delete_group_member/5 deletes a user from a group. If the group or the user does not exist, this function returns an error, otherwise it returns true . When delete_group_member/3 is called the Port and Dir options are mandatory. list_group_members(GroupName, Options) -> {ok, Users} | {error, Reason} list_group_members(GroupName, Port, Dir) -> {ok, Users} | {error, Reason} list_group_members(GroupName, Address, Port, Dir) -> {ok, Users} | {error, Reason} Types GroupName = string() Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() Users = list() AuthPassword = string() Reason = term() list_group_members/2, list_group_members/3 and list_group_members/4 lists the members of a specified group. If the group does not exist or there is an error, {error, Reason} is returned. When list_group_members/2 is called the Port and Dir options are mandatory. list_groups(Options) -> {ok, Groups} | {error, Reason} list_groups(Port, Dir) -> {ok, Groups} | {error, Reason} list_groups(Address, Port, Dir) -> {ok, Groups} | {error, Reason} Types Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() Groups = list() AuthPassword = string() Reason = term() list_groups/1, list_groups/2 and list_groups/3 lists all the groups available. If there is an error, {error, Reason} is returned. When list_groups/1 is called the Port and Dir options are mandatory. delete_group(GroupName, Options) -> true | {error,Reason} <name>delete_group(GroupName, Port, Dir) -> true | {error, Reason} delete_group(GroupName, Address, Port, Dir) -> true | {error, Reason} Types Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() GroupName = string() AuthPassword = string() Reason = term() delete_group/2, delete_group/3 and delete_group/4 deletes the group specified and returns true . If there is an error, {error, Rea- son} is returned. When delete_group/2 is called the Port and Dir options are mandatory. update_password(Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason} update_password(Address,Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason} Types Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() GroupName = string() OldPassword = string() NewPassword = string() Reason = term() update_password/5 and update_password/6 Updates the AuthAccessPassword for the specified directory. If NewPassword is equal to "NoPassword" no password is requires to change authorisation data. If NewPassword is equal to "DummyPassword" no changes can be done without changing the password first. SEE ALSO
httpd(3erl) , mod_alias(3erl) , Ericsson AB inets 5.5.2 mod_auth(3erl)
All times are GMT -4. The time now is 10:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy