Server root user cannot log on Linux normal user how to modify passwd file

Source: Internet
Author: User

Today a server root user can not log in, the normal user may log in.

Normal user su to root user also error

Su:bash:No such file or directory

View the next passwd file

oracle@linux-35:~> Cat/etc/passwd|grep Root

Root:x:0:0:root:/root:cd

The root of the shell has been changed to a CD, no wonder the above fault.

It is not possible to modify the passwd file directly with an Oracle user, without modifying the permissions.

So we have to use Sudoedit.

Oracle@linux-38:/etc> Sudoedit

Usage:sudoedit [-HPSB] [-P prompt] [-u username| #uid] file [...]

Oracle@linux-38:/etc> Sudoedit passwd

We Trust your have received the usual lecture from the local System

The Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.

#2) before you type.

#3) with the great power comes great responsibility.

Root ' s password:

Will

Root:x:0:0:root:/root:cd

To

Root:x:0:0:root:/root:/bin/bash

Save exit.

Oracle@linux-35:/etc> Su-root

Password:

linux-35:~ #

Root can log in.

This paper url:http://www.bianceng.cn/os/linux/201410/45602.htm

#sudo sudo executes commands through another user (execute a command as another user), and Su is used to toggle the user and then complete the task by switching to the user, but sudo can execute the command directly behind it, such as Su Do does not need the root password can perform root assignment and execution only root can execute the corresponding command, but through Visudo to edit/etc/sudoers to achieve;

#sudoedit and sudo are almost as powerful.

sudo details please view

http://zxf261.blog.51cto.com/701797/748756

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.