LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-26-2004, 04:03 AM   #1
phoenix_fei
Member
 
Registered: Nov 2004
Location: shanghai
Distribution: worket
Posts: 41

Rep: Reputation: 15
how to create user in linux


hello everyone :
i want to know how to create user ,but you do not do with shell command,i try to update the file in /etc/passwd and /etc/group in order to create user,but the user who i create do not login. i want to know why?


thanks
 
Old 11-26-2004, 04:30 AM   #2
hk_linux
Member
 
Registered: Nov 2004
Location: India
Distribution: RedHat, PCQLinux, Fedora
Posts: 95

Rep: Reputation: 15
wat abt /etc/shadow?
 
Old 11-26-2004, 04:32 AM   #3
phoenix_fei
Member
 
Registered: Nov 2004
Location: shanghai
Distribution: worket
Posts: 41

Original Poster
Rep: Reputation: 15
can you expain "wat abt/etc/shadow";
thanks
 
Old 11-26-2004, 04:48 AM   #4
hk_linux
Member
 
Registered: Nov 2004
Location: India
Distribution: RedHat, PCQLinux, Fedora
Posts: 95

Rep: Reputation: 15
There is a file called /etc/shadow, which is accessible only by root. The file will contain the encrypted password and other user info. You need to have an entry there for the user to log in. After you put an entry, use the "passwd" command to change the password of the user.
 
Old 11-26-2004, 05:08 AM   #5
phoenix_fei
Member
 
Registered: Nov 2004
Location: shanghai
Distribution: worket
Posts: 41

Original Poster
Rep: Reputation: 15
i have to update it,but not login it .
 
Old 11-26-2004, 05:11 AM   #6
phoenix_fei
Member
 
Registered: Nov 2004
Location: shanghai
Distribution: worket
Posts: 41

Original Poster
Rep: Reputation: 15
hello

are you tell me if i want to create user with sys_call,
how to it .
thanks
 
Old 11-26-2004, 05:27 AM   #7
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
phoenix_fei, can you show us the lines you added in the /etc/passwd, /etc/shadow and /etc/group files for us to be able to find out what's wrong ?
 
Old 11-26-2004, 10:13 AM   #8
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
`adduser`.

End
 
Old 11-27-2004, 11:47 AM   #9
Present
Member
 
Registered: Jan 2004
Distribution: suse/slack/gentoo/lfs (not-in-that-order)
Posts: 284

Rep: Reputation: 30
try this as su:

su <super user password>
adduser -g <groupname> <username>
passwd <username> <password>

like this..
Code:
su WiaasdQ1
adduser -g users bobo
passwd bobo BiMbO
that should make the needed entries...

then i would suggest making a directory in /home for them with permissions drwxr-xr-x:

edited:
for clairification...
su <super user password>
mkdir <desired /home directory>
chmod <permission> <desired /home directory>
example below:
/edited


Code:
su WiaasdQ1
mkdir /home/bobo
chmod 755 /home/bobo
oh ya, don't forget to make bobo owner and set group to users

that should take care of it.

to add a long list of users, consult other threads like this <click here> thread for making a script...

hope that helps,
pres

Last edited by Present; 11-27-2004 at 02:05 PM.
 
Old 11-27-2004, 12:24 PM   #10
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
su WiaasdQ1
mkdir /home/bobo
chmod 755 /home/bobo
That script isn't going to work, the new user isn't allowed to create a directory in /home, this should be done by root, and chowned to WiaasdQ1.
 
Old 11-27-2004, 01:53 PM   #11
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
Moving to Linux-General.
 
Old 11-27-2004, 02:01 PM   #12
Present
Member
 
Registered: Jan 2004
Distribution: suse/slack/gentoo/lfs (not-in-that-order)
Posts: 284

Rep: Reputation: 30
Quote:
Originally posted by jlliagre
That script isn't going to work, the new user isn't allowed to create a directory in /home, this should be done by root, and chowned to WiaasdQ1.
the example WAS su; "WiaasdQ1" was an example of a possible su password ;-)
 
Old 11-27-2004, 11:31 PM   #13
phoenix_fei
Member
 
Registered: Nov 2004
Location: shanghai
Distribution: worket
Posts: 41

Original Poster
Rep: Reputation: 15
hello eveyrone,i know that you say.but i want t o achieve with C++ in order to create user.what i should do ?

thanks .please reply me?
 
Old 11-27-2004, 11:52 PM   #14
Present
Member
 
Registered: Jan 2004
Distribution: suse/slack/gentoo/lfs (not-in-that-order)
Posts: 284

Rep: Reputation: 30
perhaps start a new thread and post a subject line that says it all, saving potential contributers from having to read a bunch of posts now unrelated to your objective.

try a subject like this maybe:

how to create multiple users using c++?

just a suggestion, and good luck
 
Old 11-28-2004, 12:56 AM   #15
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 25, 26, RHL 5.2
Posts: 560

Rep: Reputation: 56
There are a few functions that may help. Using man check out putpwent and shadow. This will tell you what header files and functions to use for adding entries to /etc/passwd and /etc/shadow. As hk_linux mentioned there must be an entry in /etc/shadow to allow a user to login.

Bill
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
user home dir doesn't create when new user add dev_mohamed Linux - Software 3 01-12-2007 01:08 AM
how to create linux user novaprime Linux - Security 3 08-15-2005 03:31 PM
linux create user account deus1 Linux - General 2 06-04-2005 06:32 PM
How do I create a default user profile in Linux Sm1ler Linux - General 2 07-01-2004 07:35 AM
Can't create new user for linux. Help! jbeedham Linux - General 5 08-22-2003 01:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:34 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