Visit Our UNIX and Linux User Community

Assign default password to new users in Solaris

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Assign default password to new users in Solaris
# 1  
Old 01-04-2012
Assign default password to new users in Solaris

Hi All,

I am working on a Solaris 10 machine and now working with a user creation script. I want to create users using the script and assign a default password.

I found the use of 'expect' in one post, but 'expect' is not available in our server.

Also, the below code is not working for me.
# useradd -m -d /home/foo foo
# echo "foo" | passwd --stdin foo
Changing password for user foo.
passwd: all authentication tokens updated successfully.

Now I am thinking of editing the /etc/shadow file with the password string of other user. But I am really afraid to try this way as our servers are live having 100+ users. can anyone suggest if editing the /etc/shadow file using the below 'sed' command will work?
sed "s/${name}/${name}:${passwd}/" /etc/shadow > /tmp/shadow.tmp 
cp /tmp/shadow.tmp /etc/shadow 
rm /tmp/shadow.tmp

Or Can you help me with a new way of doing it?

Thanks in advance.
# 2  
Old 01-04-2012
have a look at man usermod, the section OPTIONS, option -p.

perform tests on a test account

see ya
This User Gave Thanks to frappa For This Post:
# 3  
Old 01-05-2012
Hi Frappa,

Thanks for your reply.

I couldn't find a '-p' switch for 'usermod' neither in 'man' nor in practical.
Any other way comes to your mind!!?


Previous Thread | Next Thread
Test Your Knowledge in Computers #583
Difficulty: Easy
Buffered input/output is used because I/O operations can slow the system down.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to read through a file and create new users/assign them to groups in Ubuntu

Hi all. I need a shell script that can, in short, read through a text file line by line and create a new user in Ubuntu, as well as assign that user to a group. The format of the text file is not important but preferably: 'username:group'. I don't have much programming knowledge no matter shell... (3 Replies)
Discussion started by: LewisWeekly
3 Replies

2. Solaris

Sol 10 PAM config - how to assign modules to specific users

Hi, was after some help for the following. I want to enforce local passwd authentication for service accounts and kerberos authentication for users. Solaris 11 lets me assign different PAM modules to specific users via usermod and linux lets me define via UID, but I can't find a way to do this... (0 Replies)
Discussion started by: melias
0 Replies

3. Solaris

Change password for users

I am on SunOS SolarisServer 5.11 11.1 i86pc i386 i86pc , I am trying to change password for a user,but I get the following message.I cannot find any google help on the matter.can anyone help? root@SolarisServer:~# passwd passwd: Changing password for stain Please try again Please try... (6 Replies)
Discussion started by: cbtshare
6 Replies

4. UNIX Desktop Questions & Answers

Too many users with root password

Hi there, I'm working with a Linux server and now I can get a daily Logwatch mail ... my question is:since there are too many users with root password ( my opinion... :mad:) how could I prevent to delete information about "su" log? Thanks in advance, GB (3 Replies)
Discussion started by: Giordano Bruno
3 Replies

5. Shell Programming and Scripting

script to change password for all users

We have a server where we have a number of user ids and we also have the list of old passwords in a CSV file. Now we want to change the password of all the users and assign them a default password.Can we write a shell script to do that. I am planning to read the user name and corresponding... (7 Replies)
Discussion started by: dr46014
7 Replies

6. Shell Programming and Scripting

Help- Change the password of users to common one

Hi all I have some 106 users of which i need to change the password of them to a common one. I dont know their paswword. But i need to reset them to a common one. How can i do this with a shell script? It would be a great help if some one can help to sort out this.:b::b: I know it can be... (0 Replies)
Discussion started by: Tuxidow
0 Replies

7. UNIX for Dummies Questions & Answers

can I assign permissions only for some users ?

I know how to change permissions for the owner, group or others. if I want a file readable for a group A of users and writable for a group B how can I do it ? thanks (2 Replies)
Discussion started by: aneuryzma
2 Replies

8. UNIX for Dummies Questions & Answers

Have users changed their password

How can I know users have changed their passwords ? I don't need their password (!) I have to know if they have changed their pass word and when ? Thank you in advance for any SIMPLE answer. (6 Replies)
Discussion started by: annemar
6 Replies

9. UNIX Desktop Questions & Answers

list the password settings for all the users

Hi!! How can I list the password settings for all the users?? Best regards (3 Replies)
Discussion started by: irasela
3 Replies

10. Shell Programming and Scripting

How best to extract the users home from /etc/password

What would be the best way to extract a users home from /etc/passwd. I intended to use cut but have been semi advised that a can do it using and eval statement and the ~ operator. Unfortunately this was just a casual conversation so made little sense at the time. Any help much appreciated. cheers (4 Replies)
Discussion started by: spaceship
4 Replies

Featured Tech Videos