Kill lui lei dog---password management and user Switching and sudo usage under Linux no:27 Linux

Source: Internet
Author: User

Our user name under Windows can be set blank password login, but in Linux must be set up a password to log in, otherwise it will fail ...

Setting a password under Linux can be set using the passwd command ...

But here the passwd is not the ETC directory of passwd we can use which to see what he is the passwd, as follows:

It is obvious that he is stored in the USR/BIN/PASSWD.

Then we use the passwd command to set a user password (this method is only for the root user, he does not work for ordinary users), as follows:

This can be successful to the user Lisi set to the password .....

However, it is important to note that if you do not enter a user name, just use the passwd, it will become a change of their own password ....

If other users want to change the password must be the security of the Linux prompt to the line, otherwise it will display the error, as follows:

passwd-d User name: Delete a user's password as follows:

PASSWD-L User name: Lock a user's password:

Passwd-u user name: Unlock a user's password:

Su and sudo

SU: is a command used to switch users

For example, we are now Lisi user login, then we use SU login root account, then we must know the password to be able to log in, as follows:

This will make the login successful ....

sudo: is a Linux system Management Directive, a tool that allows a system administrator to let ordinary users perform some or all of the root commands, such as HALT,REBOOT,SU, and so on. This not only reduces the login and administration time of the root user, but also improves security.

Under normal circumstances, etc directory of shadow files (which record this account password) We are only root can be viewed, ordinary users are unable to view, as follows:

Then use Lisi's account to see:

The discovery is not viewable, then we use sudo to test the following as follows:

After the return to find the password, then a password to him:

But given the password or not, the permissions are not enough, you have to configure permissions to him to do it ...

Then we'll give him a test at the root account, as shown below:

After carriage return, the results are as follows:

So we'll add a sentence to him in line 99.

This means that root gets all the permissions on the server, and we add this sentence to let the Lisi user also get all the permissions, and then save the exit.

Then we'll test it again with the Lisi account, the sudo command can be used to view the password, as shown below:

Plainly, Sudo is to borrow the Administrator account permissions, and then to do something that administrators can do, because many times the administrator account is not likely to develop to many people to use ...

For a server may involve several roles, such as: Database administrator, Application server administrator, they may sometimes need to use some of the administrator's permissions, but this time we can not tell their root password.

So we will give him to configure some detailed permissions, probably with the root account permissions, or perhaps smaller than the root, this time their account to use the command must be used to sudo to invoke the Administrator account permissions, and then to perform some operations can be.

Here's how to use sudo ...

Kill lui lei dog---password management and user Switching and sudo usage under Linux no:27 Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.