Install Linux shadow password

Source: Internet
Author: User

1. Prepare a boot chip at hand
If a serious error occurs, it is useful to have a boot disk. If you want to install the boot/root package, you can refer to Bootdisk-HOWTO to create a root boot chip.
2. Remove the copied man pages.
You should also update the operation manual. Even if you are so powerful that you do not need to back up and install Shadow Suite, you still need to remove the old operation manual, because the new operating manual cannot normally overwrite the old one.
You can use the man-aW command and the locate command to find the operation manual for standby removal. It is easier to find the older version before you execute make install.
If you use Slackware 3.0, the operation manual you want to remove is:
/Usr/man/man1/chfn.1.gz
/Usr/man/man1/chsh.1.gz
/Usr/man/man1/id.1.gz
/Usr/man/man1/login.1.gz
/Usr/man/man1/passwd.1.gz
/Usr/man/man1/su.1.gz
/Usr/man/man5/passwd.5.gz
The same name needs to be deleted in the/var/man/cat [1-9] Directory.
3. Execute make install.
Now you have prepared to enter: (run as root)
Make install
This will install the latest and updated programs and fix the File Permission. It also installs the operation manual.
This will also take the Shadow Suite inclusion file into the correct location/usr/include/shadow into consideration during installation.
To use the BETA kit, you need to manually copy the login. defs file to the/etc directory, and make sure that only the root permission can be changed.
Cp login. defs/etc
Chmod 700/etc/login. defs
This file is the configuration file of the check-in program. You should check and confirm the change of this file. This is where you decide which tty root can be checked in and set other security policies (like the expiration date of the preset password ).
4. Run pwconv.
The next step is to execute pwconv. This also needs to be executed as root and preferably in the/etc directory:
Cd/etc
/Usr/sbin/pwconv
Pwconv retrieves your/etc/passwd file and deletes some columns to create two files:/etc/npasswd and/etc/nshadow.
A pwunconv also provides a normal/etc/passwd file for creating a/etc/passwd and/etc/shadow combination.
5. Rename npasswd and nshadow.
Now you have run pwconv, And you have created/etc/npasswd and/etc/nshadow files. Copy the file to the/etc/passwd and/etc/shadow files. We also need to copy the original/etc/passwd file and make sure that only the root user can read it. We put the file in the root directory:
Cd/etc
Cp passwd ~ Passwd
Chmod 600 ~ Passwd
Mv npasswd passwd
Mv nshadow shadow
You should also confirm that the owner of the file and the access permission are correct. If you want to use X-Windows, xlock and xdm, you may need to read the shadow file (but do not need to write this file ).
There are two ways to do this. You can set the suid of xlock to root (xdm is usually executed as root ). Alternatively, you can make the root user a shadow group and have a shadow file. Before doing so, make sure that you already have a shadow group (which can be seen in the/etc/group file ). We should not change whether any user is in shadow group.
Chown root. root passwd
Chown root. shadow
Chmod 0644 passwd
Chmod 0640 shadow
Your system now has a shadow password. Now you should reopen a terminal window and confirm that you can check in (login ).
Please do it right away!
If you cannot, something may be wrong! To return to the to a non-shadowed status, perform the following steps:
Cd/etc
Cp ~ Passwd
Chmod 644 passwd
You will re-store these files to the correct location where you previously stored them.

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.