![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Interpreting the encrypted shadow password? | keelba | Linux | 5 | 03-12-2008 06:13 PM |
| *LK* in /etc/shadow file | vikashtulsiyan | SUN Solaris | 5 | 12-23-2007 08:50 PM |
| shadow file after a password reset | progressdll | UNIX for Dummies Questions & Answers | 0 | 10-31-2007 02:18 AM |
| shadow file | jbashir | UNIX for Advanced & Expert Users | 3 | 03-14-2006 12:22 AM |
| remove shadow password | gizaa | UNIX for Dummies Questions & Answers | 2 | 08-03-2004 04:30 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I want to append password into /etc/shadow file using a shell script. My below script does add the users to both /etc/passwd and /etc/shadow but how can I add the hordcoded passwords to /etc/shadow file can some one help me ? # To add the groups into /etc/group file for a_user in nortel admin netmgr master operator ttbuser orbix oracle do /usr/sbin/useradd $a_user >> one done |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Passwords
The password in /etc/shadow is encrypted. To add/change a password, use the passwd command (see the man pages for options).
cheers |
|
#3
|
|||
|
|||
|
Quote:
# To add the users into /etc/password file for a_user in nortel admin netmgr master operator ttbuser orbix oracle do /usr/sbin/useradd $a_user done This will add the users into /etc/password and /etc/shadow file. But how can I add passwords into shadow file withought using expect and in non Interactive mode ? |
|
#4
|
||||
|
||||
|
I'll tell you what I do, but it is a little risky. First I add the users to a "prototype" box. This is just some box where I start. I add the users, assign initial passwords, and I ask the user to sign on, change their passwords, and be sure that they like the shell, gcos info etc. I do not want to copy this around and then find that they csh or something. After the users accounts are all ready on the prototype box, I extract their lines from /etc/password and /etc/shadow. I use this to create a simple script that appends the lines to /etc/passwd and /etc/shadow. The script also makes the home directories, etc. I test this script on a test system. Once I am sure that I trust the script, I use an automated procedure to transfer to the boxes in question and run it. Like I said, this is a little risky. But I am careful and I am confident that I can correct any fumbles that occur.
|
|
#5
|
|||
|
|||
|
Quote:
If you can write one command (sed or any one else) then it will be good help for me. Thanx a lot |
|
#6
|
||||
|
||||
|
Code:
#! /usr/bin/ksh cat >> /etc/passwd << \EOF joeblow:x:1158:20:Joseph Q Blow:/home/joeblow:/bin/ksh tomjones:x:1159:20:Thomas Jones:/home/tomjones:/bin/ksh EOF cat >> /etc/shadow << \EOF joeblow:xxxxyyyyzzzz1:13220:::::: tomjones:xxxxyyyyzzzz1:13220:::::: EOF exit 0 |
||||
| Google The UNIX and Linux Forums |