Another command that might be available and also works quite well for this is 'blkid'. It's part of the e2fsprogs package. Examples of it's usage:
Look up data on /dev/sda1:
topher@crucible:~$ sudo blkid /dev/sda1
/dev/sda1: UUID="727cac18-044b-4504-87f1-a5aefa774bda" TYPE="ext3"
Show UUID data for all partitions:
topher@crucible:~$ sudo blkid
/dev/sda1: UUID="727cac18-044b-4504-87f1-a5aefa774bda" TYPE="ext3"
/dev/sdb: UUID="467c4aa9-963d-4467-8cd0-d58caaacaff4" TYPE="ext3"
Show UUID data for all partitions in easier to read format:
(Note: in newer releases, blkid -L
has a different meaning, and blkid -o list
should be used instead)
topher@crucible:~$ sudo blkid -L
device fs_type label mount point UUID
-------------------------------------------------------------------------------
/dev/sda1 ext3 / 727cac18-044b-4504-87f1-a5aefa774bda
/dev/sdc ext3 /home 467c4aa9-963d-4467-8cd0-d58caaacaff4
Show just the UUID for /dev/sda1 and nothing else:
topher@crucible:~$ sudo blkid -s UUID -o value /dev/sda1
727cac18-044b-4504-87f1-a5aefa774bda
Short answer: you can't. Ports below 1024 can be opened only by root. As per comment - well, you can, using CAP_NET_BIND_SERVICE, but that approach, applied to java bin will make any java program to be run with this setting, which is undesirable, if not a security risk.
The long answer: you can redirect connections on port 80 to some other port you can open as normal user.
Run as root:
# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
As loopback devices (like localhost) do not use the prerouting rules, if you need to use localhost, etc., add this rule as well (thanks @Francesco):
# iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 8080
NOTE: The above solution is not well suited for multi-user systems, as any user can open port 8080 (or any other high port you decide to use), thus intercepting the traffic. (Credits to CesarB).
EDIT: as per comment question - to delete the above rule:
# iptables -t nat --line-numbers -n -L
This will output something like:
Chain PREROUTING (policy ACCEPT)
num target prot opt source destination
1 REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080 redir ports 8088
2 REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 8080
The rule you are interested in is nr. 2, so to delete it:
# iptables -t nat -D PREROUTING 2
Best Answer
If the Squid is listening on port, let's say 3128, you can list all connected IP addresses to this port by using command like
netstat
in the server.For example:
will display something like below:
You can ignore the first line, that displays the default listening of squid service. For the rest of rows, 4th row is the local server ip and 5th row lists the remote endpoint (the clients connecting to proxy). On the 6th column you can see the tcp connection status. The
ESTABLISHED
signifies a currently active connection.You can only list the estbalished connection with this:
You may use the command without the
-n
option, to display hostname, instead of ip addresses.