Add a user with no password


 
Thread Tools Search this Thread
Operating Systems Linux Add a user with no password
# 1  
Old 11-07-2012
Add a user with no password

I want to add a user like below in Linux. Please assist

Quote:
cat /etc/shadow|grep test
test:x:60010:1:test user:/home/test:/bin/bash
Below is the information from /etc/passwd file

Quote:
test:x:60010:1:test user:/home/test:/bin/bash
---------- Post updated at 02:04 PM ---------- Previous update was at 10:05 AM ----------

Quote:
Originally Posted by prash358
I want to add a user like below in Linux. Please assist



Below is the information from /etc/passwd file
Not sure why there is X in shadow file
# 2  
Old 11-07-2012
This is not, what a shadow file looks like. If you look closer, you will see, that both lines are identical and they are from the passwd file. A shadow file entry looks like this:

Code:
test:$6$rW7KQGB/$ir3tl2gier.4PuoNtoQAecl/FtXBCF87bGsJJ4uAoWhFhpko3ae4hKlIZDFjrhPigdl.vX4uh1DXSTReGI.Wz0:15628:0:99999:7:::

# 3  
Old 11-07-2012
Quote:
Originally Posted by hergp
This is not, what a shadow file looks like. If you look closer, you will see, that both lines are identical and they are from the passwd file. A shadow file entry looks like this:

Code:
test:$6$rW7KQGB/$ir3tl2gier.4PuoNtoQAecl/FtXBCF87bGsJJ4uAoWhFhpko3ae4hKlIZDFjrhPigdl.vX4uh1DXSTReGI.Wz0:15628:0:99999:7:::

No i am sure the entry is same on both /etc/passwd and /etc/shadow files.

---------- Post updated at 02:38 PM ---------- Previous update was at 02:35 PM ----------

Btw if i want to run a script with user "test" and there should be a home directory created for the user, how should i create the account?

when i issued below command, so looks like it is passworded, but thwn i look it in /etc/passwd and /etc/shadow files there is X as mentioned above.

Quote:
# passwd -s test
test PS
# 4  
Old 11-07-2012
To create a user, use the useradd-command. To create a home directory at the same time, use the -m option.
# 5  
Old 11-07-2012
Quote:
Originally Posted by hergp
To create a user, use the useradd-command. To create a home directory at the same time, use the -m option.
Thank you for the reply, but how can we set the user account to "x" in shadow file? or what do we mean by "X" in shadow file

---------- Post updated at 03:57 PM ---------- Previous update was at 02:46 PM ----------

Quote:
Originally Posted by hergp
This is not, what a shadow file looks like. If you look closer, you will see, that both lines are identical and they are from the passwd file. A shadow file entry looks like this:

Code:
test:$6$rW7KQGB/$ir3tl2gier.4PuoNtoQAecl/FtXBCF87bGsJJ4uAoWhFhpko3ae4hKlIZDFjrhPigdl.vX4uh1DXSTReGI.Wz0:15628:0:99999:7:::

Sorry below is what i have in the /etc/shadow file

Quote:
test:x:13622::::::
# 6  
Old 11-08-2012
The x in the passwd file means, that the password hash is stored in the shadow file.

In the shadow file, it means, that there is no valid password set. So the user is not locked, but can not log in.

To set a password for the user, use
Code:
passwd username

as root to set a password for the user.
# 7  
Old 11-24-2012
Quote:
Originally Posted by prash358
No i am sure the entry is same on both /etc/passwd and /etc/shadow files.
If that's how your shadow file looks, then you're in trouble. Stuff like group membership and login shell are what gets stored in /etc/passwd. The fields in /etc/shadow should all be related to password policy and password hashes. I'm willing to bet they both came from /etc/passwd otherwise your system would be in total failure and that would probably take

It's probably better to focus on _why_ you're interested in getting rid of passwords. If it's to get scripted access to this account from a remote system, you can set up passwordless ssh. If it's for scripted access to the account locally, use sudo.

If it's just to keep from having to enter your password at the login prompt you may ask whether this is really something you want to do and if so just blanking out the hash field will get you out of entering a password on most systems.

For example, where you have:

Code:
testuser:!!:15668:0:99999:7:::

or
Code:
testuser:$6$4IMQBefy$J3rmoxs9b/aErid5ihr2N4PDLtPRRpQHATaUmSaazohR1K0vvZClhX.5aueEq6nOCRYkjBruYEMVaEKqofbwO1:15668:0:99999:7:::

Should become:
Code:
testuser::15668:0:99999:7:::

I've only tested this on logging into the desktop and from a TTY. Logging in remotely can be taken care of the other way (via ssh) though.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

User password reset

Hello - I want to reset user password in multiple server via root ID. I have passwordless authentication for root between all the servers. I an use loop to reset the password. I am using below command in loop echo mypassword | passwd username --stdin However, if anyone sees history - he... (5 Replies)
Discussion started by: saurabh84g
5 Replies

2. Shell Programming and Scripting

How to scp File from root user in one server to say crt user in another server and avoid password?

Can someone help in writing some script through which I can transfer file (scp) from root user in abc server to crt user in hfg server and can give the crt user password in script itself so that it doesn't prompt me every time for password (4 Replies)
Discussion started by: Moon1234
4 Replies

3. Shell Programming and Scripting

switch as another user without password

I want to switch as another user without using password .Is it posiible ? I have one server B and I have logged in as username u1 but I want to login to that same server using username as u2 but I don't want to give the password for u2. (3 Replies)
Discussion started by: maitree
3 Replies

4. UNIX for Advanced & Expert Users

password verification verify password of a user for only first 8 characters

Helo , I m using linux pam library for user and its password authentication. I m creating new user and giving its password.I m giving password of 10 characters.now when I login in as that newly created user its ask me $ su - ram Password: You are required to change your password immediately... (12 Replies)
Discussion started by: amitpansuria
12 Replies

5. Solaris

help adding a new user/password

I just installed Solaris 10 yesterday and I need to create a new username and password. I'm new to the system and I have yet to learn my way around. I appreciate all help and thank you in advance. (5 Replies)
Discussion started by: bones
5 Replies

6. UNIX for Advanced & Expert Users

control user password

I have two unix server ( eg. they are Server A , Server B ) and want to use LDAP to control the user profile , each of these servers have some database and application are running , assume I have setup Server A as LDAP server . Now I am not too understand the practice of it, could anyone can advise... (0 Replies)
Discussion started by: ust
0 Replies

7. UNIX for Dummies Questions & Answers

Add User and Password

hello i have some probelm in the Unix Sun system ....so anyone can u help me how to sovle the problem : 1.how to add the user name and password. 2.list out the command.. Thank You (1 Reply)
Discussion started by: alan thui
1 Replies

8. Shell Programming and Scripting

How to add new user and password through script

Hi Everybody I want to write a script in solaris that will add user and set his password. How I will do that. Moreover, if anybody knows where can i find documentation, material and downloads for sample scripts in solaris then please tell me. Thanx Ehsan (1 Reply)
Discussion started by: ehsan
1 Replies

9. UNIX for Dummies Questions & Answers

user Id vs Password

Hello out there in unix.com land. I am Cerberus and this is my first post. I am brand new to Unix and i have a quesiton for you all. Relating to the Unix Password File Setup, what is: User ID? Password? any insite comparing one to the other as far as specifics would be greatly... (2 Replies)
Discussion started by: Cerberus
2 Replies
Login or Register to Ask a Question