how to remove the non : characters after the password in shadow file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to remove the non : characters after the password in shadow file?
# 1  
Old 08-17-2012
how to remove the non : characters after the password in shadow file?

On SPARC Solaris 10. I set the app account so it's expired. I also want it
so not required to change password at first login, I can do this by
removing the numbers after the password in /etc/shadow.

example using user1

The /etc/shadow file looks like this:
Code:
user1:kOmcVXAImRTAY:0::::90::

Want it to be like this:
Code:
user1:kOmcVXAImRTAY:::::::

How can I do that via a script? I want to do it on multiple servers, hence the script.
# 2  
Old 08-17-2012
To disable password expiration use:
Code:
passwd -x -1 user1

To disable forced password change on next login use:
Code:
passwd -u user1


Last edited by bartus11; 08-17-2012 at 04:32 PM..
# 3  
Old 08-17-2012
I do that, but then when the app tries to ssh to this app account, they are required to change password at first login.
I don't want that. When I remove everything between the : after the password, then the pw doesn't need to be changed anymore either.
# 4  
Old 08-17-2012
I edited my post. To avoid forced password change use:
Code:
passwd -u user1

# 5  
Old 08-17-2012
hmmm, I didn't see the other part with the -u. I thought that is just for unlocking a locked password. I will try it. Thanks.

---------- Post updated at 06:53 PM ---------- Previous update was at 03:38 PM ----------

This works as desired in the global zone
Code:
ssh $nn "passwd -x -1 fstone;passwd -u fstone"

but not in a zone, I end up with the 90 that I need to get rid of
Code:
user1:irCl6P1wBEBUQ:15569::::90::

# 6  
Old 08-18-2012
To get rid of the "90" use the second command...
Code:
passwd -x -1 user1

# 7  
Old 08-18-2012
Getting rid of the User ID (the value between the 2nd and 3rd <colon>s) and Group ID (between the 3rd and 4th <colon>s) is a VERY BAD idea. It will either make it impossible for any of the users whose entries you changed to login or it will give all of them root access!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using the encrypted password of the shadow file

i have an application that uses the encrypted password that's in the /etc/shadow file. i copied the line for the particular username i was interested it in from shadow file and i pasted it into the password file of the application. the application is nagios. this application allowed that... (5 Replies)
Discussion started by: SkySmart
5 Replies

2. Shell Programming and Scripting

Users who have never changed their password from /etc/shadow.

Hello, I have to do a script which returns users who have never changed their password from /etc/shadow. Here is what have I done and I'm not sure if it's ok. I tried to return just users who doesn;t have password set or are locked. Can be there other kind of user who never changed the... (3 Replies)
Discussion started by: catalint
3 Replies

3. Red Hat

Shadow file password policy

Today i was going through some of security guides written on linux . Under shadow file security following points were mentioned. 1)The encrypted password stored under /etc/shadow file should have more than 14-25 characters. 2)Usernames in shadow file must satisfy to all the same rules as... (14 Replies)
Discussion started by: pinga123
14 Replies

4. UNIX for Advanced & Expert Users

/etc/shadow encrypted password

Hi I wonder whether is possible to generate enrypted passwd for some user and paste it into /etc/shadow file ? What kind of encryption is used in /etc/shadow file ? ths for help. (1 Reply)
Discussion started by: presul
1 Replies

5. Solaris

Password Recovery From /etc/shadow file

Is it possible to reset a normal user password , by editing password field in /etc/shadow file? Thanks (6 Replies)
Discussion started by: ksvaisakh
6 Replies

6. Solaris

hash password in shadow show 'x' ???

Hello, I want to know the reason behing the scene why some systems have hashed password in /etc/shadow file as "x" not the alienoid language like A1Dksxi3kaA.. (13 characters) As far as I understand, etc/password will show password as "x" and move all hashed password to etc/shadow.... (8 Replies)
Discussion started by: Smith
8 Replies

7. Linux

Interpreting the encrypted shadow password?

We are currently using a script to copy the same encrypted password between our HP-UX and Solaris servers editing the trusted and shadow files directly. The encrypted password is only 13 characters long on both servers and decrypts the same way. Is there a way to copy this same string to Linux... (5 Replies)
Discussion started by: keelba
5 Replies

8. UNIX for Dummies Questions & Answers

shadow file after a password reset

hi, I had to reset a lost root password by editing the /etc/passwd and /etc/shadow files ( this is a xen vm file, so i mounted and chrooted the file ) after the reboot with an empty password on root , i have set a new password with passwd but it only changed the /etc/passwd file.... (0 Replies)
Discussion started by: progressdll
0 Replies

9. Shell Programming and Scripting

I want to append password in /etc/shadow file

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... (5 Replies)
Discussion started by: modgil
5 Replies

10. UNIX for Dummies Questions & Answers

remove shadow password

Does anyone know how to remove a stanza in the shadow password file if the user account has already been removed on an AIX box? I know it can be done by editing the file itself but I would prefer not to do it that way. cheers gizaa (2 Replies)
Discussion started by: gizaa
2 Replies
Login or Register to Ask a Question