Need one line command to create and set password for new user...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need one line command to create and set password for new user...
# 1  
Old 04-24-2015
Need one line command to create and set password for new user...

Using useradd abc --password password
# 2  
Old 04-24-2015
WHAT exactly is your request?
# 3  
Old 04-24-2015
need one line command

I want one command in which I should be able to create a new user with password assigned to it (combination of useradd and passwd command)

One I have tried is
useradd abc --password password123

but it's not working
# 4  
Old 04-24-2015
What is not working? man useradd:
Quote:
-p, --password PASSWORD
The encrypted password, as returned by crypt(3). The default is to disable the password.

Note: This option is not recommended because the password (or encrypted password) will be visible by users listing the processes.

You should make sure the password respects the system's password policy.
# 5  
Old 04-24-2015
It could be a help:
Code:
useradd test;echo <your_password> |chpasswd test

This User Gave Thanks to nixhead For This Post:
# 6  
Old 04-24-2015
thanks nixhead..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to set user password to never expire in UNIX servers

Hi, I have a requirement where in i need to write a shell script to set users password to never expire. I know the command which is used to perform the same .. which is chage command. But, could not figure out how to do the same in shell script. Could you please help me with the shell... (3 Replies)
Discussion started by: suren424
3 Replies

2. Shell Programming and Scripting

how to run a command line with another user without prompts for password

Hi, I'm writing a script, in the script I need to use tcpdump to capture some packets however it needs root priviledge my computer is configured by school and I have no real root priviledge so I can't use sudo on my computer,like Code: sudo tcpdump ...... I have to use a limited... (1 Reply)
Discussion started by: esolve
1 Replies

3. Solaris

Create New Group/User/Password in S10

I have performed the following with lower case group and usernames and the only difference is that the error message under groupadd goes away, yet I am still unable to successfully add a user WITH a home directory. This is in Solaris 10. I am able to add a group, add a user, add the users... (3 Replies)
Discussion started by: Showflash
3 Replies

4. Solaris

cant set password for user

hi everybody i cant set password for user (jam) i tried to #passwd jam enter newpasswd : after enter it showing passwd : cannot get default domain:internal yp server or client error i also check cat /etc/shadow file jam:*:LK*:........ user is locked ... and i... (4 Replies)
Discussion started by: coolboys
4 Replies

5. UNIX for Dummies Questions & Answers

Running set options from the command line and bash command

I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing set you can also use them "on the command line when running a script..." and it lists this in a small table: set -o option Command Line... (5 Replies)
Discussion started by: Straitsfan
5 Replies

6. Programming

Set password of a user in phpmyadmin

I have a mysql database on the server where I have root access also to phpmyadmin. I have such a database 1, which is a table users where a user named admin. How shall be observed as the password for this user? (1 Reply)
Discussion started by: Mumie
1 Replies

7. Linux

Set password in single command

Hi, Can we set password for linux in non-interactive mode. I didn't find suitable option for this in man page. If we wnter "passwd" command, it will tell "Enter password" and "Re-enter password". i wanted to run this step in a script, and i don't want to use "expect" so i am looking for a single... (8 Replies)
Discussion started by: successlin
8 Replies

8. Shell Programming and Scripting

how to create variables in loop and assign filename after set command?

Hi, does anybody knows how to manage, that the filenames are assigned to a variable in a loop afer getting them with set command in a ksh, like: set B*.txt i=1 c=$# x=$((c+1)) echo "$x" while ] ; do _ftpfile$i="$"$i echo "$_ftpfile$i" i=$((i+1)) done The first echo returns,... (2 Replies)
Discussion started by: spidermike
2 Replies

9. Shell Programming and Scripting

Create new user account and password in shell script

I am trying to create a shell script that will: check if a specific user already exists if not, create a specific group and create the user in that group assign a password to that user, where the password is passed in as a parameter to the script The problem that I need help with is 3 on... (4 Replies)
Discussion started by: killuane
4 Replies

10. UNIX for Advanced & Expert Users

How to use SFTP from command line without entering user and password

I would like to use SFTP from command line without entering userid and password. Here is what I have gathered and did. 1) Create a public and private key pair for the protocol you want to use. To create a key pair for use by SSH2, enter: ssh-keygen -t dsa I did that and got... (7 Replies)
Discussion started by: Hangman2
7 Replies
Login or Register to Ask a Question