LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2004, 04:22 AM   #1
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Rep: Reputation: 30
can I write a script for creating a user


Hi,
Good After noon, Everybody....

This is Zameer Ahmed Syed... I would like write a script to create a new user .... i am a new one to unix and Linux... OSs .... if some body have script ot create user then please send me in mail i would really appreciate if some body helps me regding this issue....

and onemorething i would like to know

"what are the other interactive capabilities included in 'C' when compare with 'Bourne Shell'"


Thanq very much....
Zameer Ahmed Syed,
Hyd-India.
 
Old 10-11-2004, 04:38 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
this has nothign whatsoever to do with netowrking, please pick your forum more carefully next time.

there are already commands to add users, e.g. useradd. what else do you wish to be able to do?

and that second bit is just a bit of homework right? if so, please don't ask for help with it here. you need to research it yourself.
 
Old 10-11-2004, 04:44 AM   #3
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
thanx.............
 
Old 10-11-2004, 04:47 AM   #4
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
sorry sir, In networking we are creating a user only one at a time my ambiton was creating no of users (how many i want using variables..... ) at a time just runnning one script.

thanq very much for u r reply...
 
Old 10-11-2004, 05:43 AM   #5
rabeea
Member
 
Registered: Aug 2004
Location: Pakistan
Posts: 52

Rep: Reputation: 15
hi zameer,
if u want to add multiple users using only one command......then the desired command is "newuser". To use this command create a file and write the names of the users u wish to make in the format of /etc/passwd.I mean enter the entries in this file......let say "bulkusers" in the way that there are entries in /etc/passwd. tehn apply the command
#newuser bulkuser
see if it works......it worked in my case.
best of luck
 
Old 10-11-2004, 06:08 AM   #6
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
Rabeea,
I create the file (just by typing the user names ) name 'user'....

and open the file passwd .... here i didn't get any thing (i am not able to understand ) what it is... look
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0perator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
rpm:x:37:37::/var/lib/rpm:/bin/bash
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
squid:x:23:23::/var/spool/squid:/sbin/nologin
webalizer:x:67:67:Webalizer:/var/www/html/usage:/sbin/nologin
xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin
named:x:25:25:Named:/var/named:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
gdm:x:42:42::/var/gdm:/sbin/nologin
amanda:x:33:6:Amanda user:/var/lib/amanda:/bin/bash
canna:x:39:39:Canna Service User:/var/lib/canna:/sbin/nologin
wnn:x:49:49:Wnn System Account:/home/wnn:/sbin/nologin
fax:x:78:78:mgetty fax spool user:/var/spool/fax:/sbin/nologin
netdump:x:34:34:Network Crash Dump user:/var/crash:/bin/bash
nut:x:57:57:Network UPS Tools:/var/lib/ups:/bin/false
ldap:x:55:55:LDAP User:/var/lib/ldap:/bin/false
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash
ident:x:98:98ident user:/:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
mailman:x:41:41:GNU Mailing List Manager:/var/mailman:/bin/false
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
privoxy:x:73:73::/etc/privoxy:/sbin/nologin
pvm:x:24:24::/usr/share/pvm3:/bin/bash
desktop:x:80:80:desktop:/var/lib/menu/kde:/sbin/nologin
radvd:x:75:75:radvd user:/:/sbin/nologin
zameer:x:500:500:zameer ahmed syed:/home/zameer:/bin/bash
icm:x:501:501:icm_secbad:/home/icm:/bin/bash
zameer123:x:502:502:zameer ahmed syed:/home/zameer123:/bin/sh
zam123:x:503:502:duplicate of zameer:/home/zam123:/bin/sh
icm123:x:504:503:company user:/home/icm123:/bin/bash
zameer11:x:505:500:created for example:/home/zameer11:/bin/bash
zameer111:x:506:500:just example:/home/zameer111:/bin/bash


what's next....
 
Old 10-11-2004, 06:14 AM   #7
rabeea
Member
 
Registered: Aug 2004
Location: Pakistan
Posts: 52

Rep: Reputation: 15
hi zameer,

noe lets suppose ur file name is "bulkuser" and u want to enter a users named Zameer,Ali and Ahmed.
now the syntax for writing in this file will be

zameer:x:510:510:created forexample:/home/zameer:/bin/bash

ali:x:511:511:created for example:/home/ali:/bin/bash

ahmed:x:512:512:created for example:/home/ahmed:/bin/bash

save and exit the file.After putting these entries run the command

#newusers bulkuser
 
Old 10-11-2004, 06:15 AM   #8
rabeea
Member
 
Registered: Aug 2004
Location: Pakistan
Posts: 52

Rep: Reputation: 15
just create the file using the joe or cat command . enter these entries and run the command.
 
Old 10-11-2004, 06:46 AM   #9
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
hi, Rabeea.....
I follow u .... I create a file using and i done what ever u said .... after runnint the command newusers it says invalid line... why it was ...


ThanQ
Zameer Ahmed Syed...
 
Old 10-11-2004, 06:49 AM   #10
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
Rabeea,

should i use this line as first line #!/usr/bin/
 
Old 10-11-2004, 06:58 AM   #11
rabeea
Member
 
Registered: Aug 2004
Location: Pakistan
Posts: 52

Rep: Reputation: 15
yeah u can

if u cant run this command "newusers" then u can even write usr/bin/newuser.............hey .....do check whether it is newuser or newusers.
 
Old 10-11-2004, 06:59 AM   #12
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
Could anybody help me what i s the Problem.....
 
Old 10-11-2004, 07:01 AM   #13
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
useradd is more common. personally i'd never recommend editing /etc/passwd directly.
 
Old 10-11-2004, 07:19 AM   #14
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
still it gives me message like "Invalid line"......
 
Old 10-11-2004, 07:22 AM   #15
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well forget this silly script... you've still not been able to describe what you actually want to do... just try and run "useradd" as root. sometimes it might be adduser.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Samba Write share Menestrel Linux - Software 1 01-11-2005 09:16 PM
what is the command to make a user change their password after creating a new user? naweenio Linux - Newbie 7 01-05-2005 07:07 AM
Creating a script thomas289 Linux - Networking 1 12-17-2004 11:59 AM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
Pleasehelp with proftpd.conf - trying to config user to write files as other user. philg Linux - Software 1 06-21-2003 12:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration