Visit Our UNIX and Linux User Community


useradd


 
Thread Tools Search this Thread
Operating Systems Solaris useradd
# 1  
Old 12-20-2011
Error useradd

I want to creat a 27 logins in solaris.Can anyone tell me how to write a script for that so that i create at a time for all 27 people.

Thanks to guide me.
# 2  
Old 12-20-2011
# 3  
Old 12-20-2011
Code:
#!/usr/bin/bash
uid=user
i=1
numusr=27
grp=users
groupadd $mygroup
while [ $i -le $numusr ]
do
useradd  -d /export/home/$uid$i -m -s /usr/bin/ksh 
i=$i + 1
done

# 4  
Old 12-20-2011
THANKS.
So what will be the names of useid? i have useid names with me so how to add it that to scrpit?
And i need gid of all user as 100 only.
Iam new to this scripting thanks to heplSmilie
# 5  
Old 12-20-2011
Quote:
Originally Posted by h@foorsa.biz
Code:
#!/usr/bin/bash
uid=user
i=1
numusr=27
grp=users
groupadd $mygroup
while [ $i -le $numusr ]
do
useradd  -d /export/home/$uid$i -m -g 100 -s /usr/bin/ksh 
i=$i + 1
done

user names will be user1 , user2 , user20 and so forth .
if you mean user uid they will be a sequence of numeric values which starts with the last uid taken and ends with the last user that were created.
# 6  
Old 12-20-2011
what does groupadd mean here?
and after creating 27 logins i ask all 27 user to chage login names to there want.is it possible?
# 7  
Old 12-20-2011
Hello,

For the last time...

Per our forum rules, all threads must have a descriptive subject text. For example, do not post questions with subjects like "Help Me!", "Urgent!!" or "Doubt". Post subjects like "Execution Problems with Cron" or "Help with Backup Shell Script".

The reason for this is that nearly 95% of all visitors to this site come here because they are referred by a search engine. In order for future searches on your post (with answers) to work well, the subject field must be something useful and related to the problem!

In addition, current forum users who are kind enough to answer questions should be able to understand the essence of your query at first glance.

So, as a benefit and courtesy to current and future knowledge seekers, please be careful with your subject text. You might receive a forum infraction if you don't pay attention to this.

Thank you.

The UNIX and Linux Forums

Previous Thread | Next Thread
Test Your Knowledge in Computers #552
Difficulty: Medium
If variable i has the value 10, after x = 5 + (++i); the value of x after this code is 15.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Useradd with ansible

Hello, I need ansible playbook to create new user on remote server. Remote server blocked direct root login so I must login first application user and later I must run "useradd" command with sudo. I need playbook.yml and cli command. Best regards, (0 Replies)
Discussion started by: getrue
0 Replies

2. Solaris

useradd

if useradd command is deleted in solaris how do we add user (3 Replies)
Discussion started by: vivek_ng
3 Replies

3. BSD

useradd in linux

hi.. i want to know when we add a new user by useradd command in linux "ram" in the system then bydefault " ram " name directory will create inside /home/ram . why..?? i want to know behind this logic . please help me. (1 Reply)
Discussion started by: rinkugarg
1 Replies

4. Shell Programming and Scripting

Help with useradd script

Ok Im trying too make this shell script create users from my text file, I also want to type in a password for the new users. So thay can make a uniq one themself after first logon. #!/bin/sh # Sebastian schmidt clear echo "*************************************************************"... (3 Replies)
Discussion started by: chipmunken
3 Replies

5. Solaris

useradd problem

O/S: Solaris 9 Architecture: SPARC The man page for useradd states, "The new login remains locked until the passwd(1) command is executed." This is a problem for me when accessing remotely via SSH and creating a new account from the console with useradd. As soon as I try to login into the... (3 Replies)
Discussion started by: tuxsun1
3 Replies

6. UNIX for Advanced & Expert Users

useradd?

Hi Experts, when using useradd command, what are the necessary options/arguments to be included? Please advice. (4 Replies)
Discussion started by: etcpasswd
4 Replies

7. Shell Programming and Scripting

useradd

Gurus, I need to add a user to all the machines. I need a script to do this. I did one but it does not allow me to su to root within a ssh session i open. It exists saying su: Sorry. Please let me know how i can do it. I do not have the freedom of using sudo either. Regards (4 Replies)
Discussion started by: earlysame55
4 Replies

8. Solaris

useradd

Hi, I need to add a new user who will only be able to access one single folder on my Solaris 9 system. Can this be achieved by using just useradd or do i need to fiddle with auth_attr table? TIA, Selma (4 Replies)
Discussion started by: Selma
4 Replies

9. UNIX for Advanced & Expert Users

useradd

Hi. due to some needs i gave a user the premission to use useradd command with sudo. i want to know if there is a way to let him set the initial password, without giving him the premission to use passwd command as root (sudo). maybe a way to set a default password for all the new users that... (2 Replies)
Discussion started by: dorilevy
2 Replies

10. UNIX for Dummies Questions & Answers

useradd

I work on some hp ux 11.00 Servers. i have to add an user. i use the useradd command like follows: useradd -u 72022 -g 71095 -c " comment " -d /PACKAGE_NAME/home/username -s /usr/bin/sh username The command returns with error 3. The manpage means value number 3: Invalid argument supplied to an... (6 Replies)
Discussion started by: ortsvorsteher
6 Replies

Featured Tech Videos