LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-25-2007, 11:21 PM   #1
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Rep: Reputation: 33
Add a user with no password/or user pick password.


Good Day,
Is there any way I could add an account with on line
Code:
#adduser -c dog@cat.com -d /home/dog -m  dog
And when user log in for the firt time he could pick his own password.

OR Is there any way I can add password in while adding user?
I have tried
Code:
 adduser -p dog1 -c 'dog@cat.com'  dog
But that doesn't make "dog1" password for user dog.

Note I have used "passwd" utility but here I need to do whole thing once, No prompts a answers.


Thank you.
 
Old 11-26-2007, 12:13 AM   #2
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 25, 26, RHL 5.2
Posts: 560

Rep: Reputation: 56
It is possible to do this from the User Manager in one step. However the only way I know to do it from the command line requires two steps (useradd then passwd). The -p option on the useradd command uses an encrypted passwd. This is why your dog1 example did not work. It is possible to create a program to do it in one step using the crypt function. Here is a sample program. It isn't exactly what you want, but it will give you an idea of how crypt can be used with useradd in a C program.

There is a way to allow a user to login without a password, but it does not force them to set a password. This would be a security risk. It also takes two steps. One using useradd and the other modifying /etc/passwd.

Bill
 
Old 11-26-2007, 10:08 AM   #3
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Original Poster
Rep: Reputation: 33
^ Thank you for your solution.
Even more thanks for doing it in C.
There are things in you code which I would use as my starting point for sys-utilities coding in C.

Thanks once again.
 
  


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
How to add an user, without password?? cenzole Linux - Newbie 22 12-25-2017 07:05 PM
add a user with password without prompt grendel-IT Linux - Software 7 09-27-2006 03:07 PM
Add New User with Password canuck_barlow Linux - Newbie 1 09-25-2006 03:41 AM
Help! Cannot Add a User to User Manager or Change Root Password lennysokol Linux - General 2 06-25-2005 10:59 AM
add user prompt for password on login redir Linux - Newbie 2 02-28-2005 12:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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