Feedback

type to search

Can i set 2 different passwords for one single user?

Asked by [ Editor ] , Edited by vrkalak [ Moderator ]

 1 password for normal user access and other for accessing as root privileges?

NN comments
helmut
-

Could you point out any advantage over simply using the user and the root accounts with two different passwords?

or Cancel

5 answers

3

amlj [ Editor ]

If you want a user to have root privileges, you should use ‘sudo’. By default, sudo will ask for the user’s password.
You can change it, to ask for the root password instead, so that you will have to enter root password to have root privileges, and your own password for accessing the system as a normal user.
Use the ‘visudo’ command and add this line:

Defaults:username    timestamptimeout=0, runaspw, passwdtries=1
or Cancel
0

nomeata

If you just want to distinguish them at the login prompt, then you can log in directly as the user (with the user’s password) or as “root” using that as the user name and root’s password as the password.


In case root does not have a password (which is the default in Ubuntu and maybe other Debian derivatives, AFAIK), you can set one by running “sudo passwd root”.

or Cancel
0

matteoc [ Editor ]

On UNIX systems, privileges are associated to users, not to passwords. Even if you find a way to give two passwords to user joe, after login you end up being the user joe, with his own rights, uid, groups, etc.

or Cancel
0

adam.trickett [ Editor ]

There are probably ways of simulating this using PAM, but it’s a very dangerous path to take.

You are very much better off learning to use sudo as other has suggested.

or Cancel
0

abdulkarimmemon [ Editor ]

well this is not exactly what i need.
What i want is 2 different passwords for single user which i can enter at Login screen, 1 password for normal user login and other for root priviliges.

NN comments
nomeata
-

FYI: If you want to clarify your question, you should edit the question and not post an answer to it.

or Cancel

Your answer

You need to join Debian to complete this action, click here to do so.