I recently used a package (libpcap) to develop a project in Ubuntu. This package can be used for underlying parsing of network streams. However, when I 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 sudogedit/etc/passwd in shell
I recently used a package (libpcap) to develop a project in Ubuntu. This package can be used for underlying parsing of network streams. However, when I 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 linuxidc
You can find linuxidc: x: 1001: 1001: www.linuxidc.com:/home/linuxidc:/bin/bash and change the two 1000 to 0.
The final result is:
Linuxidc: x: 0: 0: www.linuxidc.com:/home/linuxidc:/bin/bash
Finally, log out of the Ubuntu system, and enter your username and password in the login user name, so that the login is the root permission. This is because the root ID is 0.