Sponsored Content
Top Forums UNIX for Advanced & Expert Users Assign default password to new users in Solaris Post 302587206 by jaiseaugustine on Wednesday 4th of January 2012 08:44:50 AM
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.
Code:
# 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?
Code:
passwd=crypted_passwd 
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.
Jaise
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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 (...in 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

8. 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

9. 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

10. 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
lgroupmod(8)						      System Manager's Manual						      lgroupmod(8)

NAME
lgroupmod - Modify an user group SYNOPSIS
lgroupmod [OPTION]... group DESCRIPTION
Modifies the user group with name group. OPTIONS
-A, --admin-add=list Add users in comma-separated list among group's administrators. -a, --admin-remove=list Remove users in comma-separated list from group's administrators. Removing users that are not currently among group's administra- tors silently succeeds. -g, --gid=gid Change group's group ID to gid. -i, --interactive Ask all questions when connecting to the user database, even if default answers are set up in libuser configuration. -L, --lock Lock group. This prevents users from using the group password with newgrp(1) to become a member of group. -M, --member-add=list Add users in comma-separated list among group's members. -m, --member-remove=list Remove users in comma-separated list from group's members. Removing users that are not currently among group's members silently succeeds. -n, --name=name Rename group to name. -P, --plainpassword=password Set group's password to password. Note that the password can be viewed while running lgroupmod using tools such as ps(1). -p, --password=encrypted Set group's password to the password represented by the hash encrypted. Note that the hash can be viewed while running lgroupmod using tools such as ps(1). -U, --unlock Unlock group. EXIT STATUS
The exit status is 0 on success, nonzero on error. libuser Jan 11 2005 lgroupmod(8)
All times are GMT -4. The time now is 04:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy