In Linux systems, in general, ports smaller than 1024 are not open to ordinary Linux users without root. But there are still some tricks that allow users without root to use ports smaller than 1024. This article will introduce how to let ordinary users use ports below 1024 in Linux.
Method One: SetUID
to the user's application settings in the user ID to perform the bit can make the program can be run with root privileges, this method allows the program to run in as root The same, but need to be very careful, this approach also poses a security risk, especially when the program to be executed is inherently a security risk.
The method used is:
1.chown root.root /path/to/application
2.#Using SetUID
3.chmod u +s /path/to/application
We can see that in the system, /usr/bin/passwd files, we use SetUID, so that each system user can use passwd to modify Password —— This is the file to modify /etc/passwd (this is only root).
Since you want to run programs with non-root users, the goal is to reduce the security risks that the program itself poses to the system. Therefore, this method requires special care.
Method 2: CAP_NET_BIND_SERVICE
Starting with version 2.1, the Linux kernel has the concept of capability, which allows ordinary users to do work that only superusers can do, including the use of ports.
Get the CAP_NET_BIND_SERVICE ability to banding to a low port even if the server is running under a non-root account. Method used:
1.# Setting CAP_NET_BIND_SERVICE
2.setcap cap_net_bind_service =+ep /path/to/application
Note:
1. This method is not universal for all Linux systems. The kernel was not provided before 2.1, so you need to check if the system you want to use is supported.
2. Also note that if you want to run The program file is a script, and there is no way for this method to work properly. Previous12Next page Total 2 pages
We all know that the Linux command plus different parameters have different effects. The following s
Linux Git is a handy manager tool. At first Git was developed for Linux and is now used in major sys
Some Red Flag Linux 6.0 system users find that their computer cant mount NTFS parti
The Linux ps command is mainly used to check the running process of the system, and
How to find the reset user name and password in the Uuntu system
How to install Eclipse and PyDev extensions in Ubuntu 14.04?
What should I do if I restart the card on the logo screen after installing Ubuntu 11.10?
Linux detection and mounting the second hard disk step
How to manually upgrade Gentoo and its kernels
How to use the Linux system Docker command
How Linux can modify the TCP port range
How to install and configure Vim IDE for Linux systems
Linux system to modify environment variables skills
Easily solve the system shutdown time is too long coup
Win XP notebook HDMI interface connection LCD TV setup process
Win7 computer clearly does not insert U disk but shows usb icon how to do
How to configure vnc under linux
Unrecognized Solution for Vista Wireless Network
How to replace the default font of Windows7 system?
Win10 system word can not open the pop-up prompt box how to do?
Start button + IE11, Windows Server 2012 R2 map reward