How does Linux modify a user's password through a script? Scripting Automation modifies user passwords?

Source: Internet
Author: User
Tags echo command stdin

Requirements Description :

Linux environment in the creation of users, involves the modification of the user's password, generally through the passwd command to modify, need to confirm multiple times, here consider a command directly to modify the password

There is no way to interact. This record.

Operation Process :

1. Use the echo command to combine the passwd command to achieve

Echo " mytest " passwd --  for user mytest. passwd: All authentication tokens updated successfully.

Note: The part marked in red is the password. passwd using the--stdin option means telling the passwd command to read the new password from the standard input. Reads the standard input from the previous pipe .

2. Verify that the password is successfully modified by toggling

su - mytest    # switching from root to normal user does not require a password   su - mytest  # to switch users again , you need to enter a password  ~]$              # password is correct, you can perform a normal switchover

Note: You can already successfully log in using a password that you previously set.

passwd's--stdin is explained as follows :

--stdin This              option was used to indicate that passwd should read the new password from standard input, which can be a Pipe.

Document creation time: July 2, 2018 13:14:12

How does Linux modify a user's password through a script? Scripting Automation modifies user passwords?

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.