root@nio:/tmp# cat adduser.sh
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Usage : $0 userfile"
exit
fi
if [ $(id -u) -eq 0 ]; then
while IFS=, read username password; do
if egrep "^$username" /etc/passwd >/dev/null; then
echo "$username exists!"
else
password=$(perl -e 'print crypt($ARGV[0], "password")' $password)
if useradd -m -p "$password" "$username" >/dev/null; then
echo "User '$username' has been added to system!"
else
echo "Failed to add user '$username'!"
fi
fi
done <"$@"
else
echo "Only root may add a user to the system"
exit
fi
Usage
Code:
root@nio:/tmp# sh adduser.sh file
User 'bart_simpson' has been added to system!
User 'maggy_simpson' has been added to system!
I'm using SAM to add users on an HP and they're adding fine. But in /etc/group it only lists the group names. It's not adding the users in there. Is there a way to have them put in there without going into SAM and modifying the group and adding them? I guess what I want to happen is when I add... (1 Reply)
Hi guys!
Just was wanting to run a command that would allow me to seperate the currently logged in users.
Basically from this format:
user1
user2
user3
To:
user1|user2|user3
(Note the lack of a pipe at the end, not sure if thats possible)
Basically it needs to be in this... (11 Replies)
Hi
I have a txt file with 4 columns where I need to add 4 empty columns in the middle meaning that I need what is currently column 4 to be column 8 in a new file.
The idea is that I have to use the file as input in a program that reads the data in column 1 and 8, so the content of the other... (8 Replies)
Hello there,
I want to add new users to my system, so, being logged in as root I do useradd -m user_name, and the new user is added to the system. The problem is that it has more privileges than I expected. If I do su user_name then I am allowed to do cat /etc/passwd , so it is... (4 Replies)
Helle,
I want to create a .ksh script in order to realize the following :
I have a .txt file organized in a bloc of information, each bloc start with 000 as following:
000...
001...
003...
004...
000...
001...
003...
004...
.
.
My aim is to add a new... (6 Replies)
I apologize if this is a simple/stupid question. When I add users in smit as root, many(most) of the fields are automatically popluated with some basic default values.
Some other admins here have access to create users via sudo, however when they create users (sudo smit users), the user gets... (3 Replies)
Dear all,
I have a question. I have a txt.file as below. i want to add 3 more columns: column3=conlum 2*column2; column4=(1-column2)*(1-column2); column5=1-column3-column4. Do you know how to do it? Thanks a lot!
file:
column1 column2
a 1
b 20
c 30
d 3
... (2 Replies)
Hi guys,
I've a simple linux script (made by my friend), which adds users to the system from userlist file. it also creates user home dir and copies certain files to the directory. To be honest, am a newbie in scripting so am unable to fully understand how the script is working. unfortunately,... (30 Replies)
HI Guys,
I have below input.
Output Base on Below Condition.
1> if forth column is empty and next coming line have same name with \es then add that column name on all rows
2>rest of all are es:vsDataEUtranCellFDD
Input:-
CCL01736 CCL01736_7A_1 es:vsDataEUtranCellFDD ... (3 Replies)
Discussion started by: pareshkp
3 Replies
LEARN ABOUT DEBIAN
srptool
srptool(1) General Commands Manual srptool(1)NAME
srptool - Simple SRP password tool
SYNOPSIS
srptool [options]
DESCRIPTION
Very simple program that emulates the programs in the Stanford SRP (Secure Remote Password) libraries using GnuTLS. It is intended for use
in places where you don't expect SRP authentication to be the used for system users.
In brief, to use SRP you need to create two files. These are the password file that holds the users and the verifiers associated with them
and the configuration file to hold the group parameters (called tpasswd.conf).
OPTIONS --bits BITS
specify the number of bits for prime numbers (used only when the --create-conf option is used).
--create-conf FILE
Generate a tpasswd.conf file.
-h, --help
Prints a short reminder of the command line options.
-i, --index INDEX
Specify the index of the parameters in tpasswd.conf to use.
-p, --passwd FILE
Specify a password file.
-c, --passwd-conf FILE
Specify a password configuration file.
-s, --salt SALT
Specify salt size for crypt algorithm.
-u, --username username
Specify username.
--verify
Just verify password.
EXAMPLES
To create tpasswd.conf which holds the g and n values for SRP protocol (generator and a large prime), run:
$ srptool --create-conf /etc/tpasswd.conf
This command will create /etc/tpasswd and will add user 'test' (you will also be prompted for a password). Verifiers are stored by default
in the way libsrp expects.
$ srptool --passwd /etc/tpasswd
--passwd-conf /etc/tpasswd.conf -u test
This command will check against a password. If the password matches the one in /etc/tpasswd you will get an ok.
$ srptool --passwd /etc/tpasswd
--passwd-conf /etc/tpasswd.conf --verify -u test
AUTHOR
Nikos Mavrogiannopoulos <nmav@gnutls.org> and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list.
This manual page was written by Ivo Timmermans <ivo@debian.org>, for the Debian GNU/Linux system (but may be used by others).
February 21st 2005 srptool(1)