Operating System - Linux
1754304 Members
3204 Online
108813 Solutions
New Discussion юеВ

How to set a user without password on Linux ?

 
SOLVED
Go to solution
yyghp
Super Advisor

How to set a user without password on Linux ?

Is that possible to set a user without password on Linux ?

I have a device which is a terminal,wants to login to the Linux automatically. That is, the users who use the device doesn't have to type in any user authentication info. before they can sign in to the Linux server.

( Security issue is not concerned at this moment, however, better solution will be appreciated )

Thanks a lot !
4 REPLIES 4
Stuart Browne
Honored Contributor
Solution

Re: How to set a user without password on Linux ?

Yes, there is a way.

Modify '/etc/shadow', and remove the encrypted password for the given user, i.e.

genericuser:$1$2PCgTfmF$BbNzJv.sc7iNJ2xB.iHfP.:12407:0:99999:7:::

to:

genericuser::12407:0:99999:7:::

If you ensure the matching /etc/passwd entry has an 'x' in the 2nd field (like all shadow-encrypted passwords), then the account will have 'no' password.

There is no nice neat command to remove a password in this manner. The 'passwd' command will force an unencryptable password (!!) if none is supplied.

WARNING: Manually modifying the passwd and shadow files is dangerous. Ensure you have a backup copy before doing anything, and make sure you can still log in (in another session) as user/root before logging the current session out.
One long-haired git at your service...
Alexander Chuzhoy
Honored Contributor

Re: How to set a user without password on Linux ?

if you don't use shadow passwords:
simply remove seconds column from the user in /etc/passwd.So the entry will look like the following.

user::500:500::/home/user:/bin/bash


use "authconfig" utility to set/unset shadow passwords.
Gopi Sekar
Honored Contributor

Re: How to set a user without password on Linux ?

I believe you dont have to touch /etc/shadow file, just edit /etc/passwd file and remove 'x' in the user id entry.

ex:

user1:x:19910:19901:/home/user1:/bin/bash

change to

user1::19910:19901:/home/user1:/bin/bash

Hope this helps,
Gopi
Never Never Never Giveup
Paul Cross_1
Respected Contributor

Re: How to set a user without password on Linux ?

Since you are asking for a better (more secure) solution, I would recommend using ssh with authorized_keys. The user wouldn't have to login with a password, but would HAVE a password, and all trafic would be encrypted as well. OR (less secure) you could use .rhosts for logins. While more secure than having no password, it is defininitely a distant second choice over ssh.

-paul.