In ubuntu/centos, how does one escalate normal users to root permissions?

Source: Internet
Author: User

Reprinted from http://blog.csdn.net/chenjieb520/article/details/7316268

I recently used a package (libpcap) when developing a project. This package can be used for underlying parsing of network streams, but when I want to use this package for network sniffing, the root permission is required and sudo is often used to run the program. In order to facilitate project debugging, the current user is promoted to the root permission.

The method for upgrading is as follows: Enter sudo gedit/etc/passwd in shell to modify the id value of the current user. For example, my current user is chenjieb.

Then you can find chenjieb: X: 1000: 1000: Administrator,:/home. chenjieb:/bin/bash and change the two 1000 values to 0. The final result is:

Chenjieb: X: 0: 0: Administrator,:/home. chenjieb:/bin/Bash: At last, the system is logged out. Then, enter your username and password in the username to log in. In this way, the root permission is obtained. This is because the root ID is 0.

Note: It is best to use the root permission to modify the file. Otherwise, the modification may fail.

I hope this tips will help you.

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.