Networking
Get the IP address (RHEL 7+)
ip addr show
Open a port (RHEL 7+)
sudo firewall-cmd --get-active-zones
sudo firewall-cmd --zone=public --add-port=8000/tcp --permanent
sudo firewall-cmd --reload
Close a port (RHEL 7+)
sudo firewall-cmd --get-active-zones
sudo firewall-cmd --zone=public --remove-port=8000/tcp --permanent
sudo firewall-cmd --reload
SSH X11 Forwarding
Enable SSH X11 forwarding
-
Install prerequisite packages:
sudo yum -y xorg-x11-xauth
-
Edit /etc/ssh/sshd_config and add this line:
X11UseLocalhost no
Test SSH X11 forwarding
-
SSH to the server with the -X flag:
ssh -X myserver
-
Install xclock
sudo yum -y install xorg-x11-apps
-
Run xclock
xclock
Use SSH X11 forwarding as another user
-
SSH to the server with the -X flag
ssh -X myserver
-
Configure xauth
-
RHEL 7:
xauth extract - $DISPLAY > /tmp/.Xauthority chmod 666 /tmp/.Xauthority sudo -iu someuser xauth merge /tmp/.Xauthority
-
RHEL 6:
xauth extract - :`echo $DISPLAY | cut -d : -f 2` > /tmp/.Xauthority chmod 666 /tmp/.Xauthority sudo -iu someuser xauth merge /tmp/.Xauthority
-
Alternatively (not recommended):
-
Copy your .Xauthority file to that user’s home folder
sudo cp ~/.Xauthority ~someuser
-
Change the ownership of the file to that user
sudo chown someuser: ~someuser/.Xauthority
-
Become that user
sudo -iu someuser
-
-
-
Test X forwarding
xclock
-
Cleanup (optional, recommended)
-
RHEL 7:
xauth remove $DISPLAY rm /tmp/.Xauthority
-
RHEL 6:
xauth remove :`echo $DISPLAY | cut -d : -f 2` rm /tmp/.Xauthority
-
Alternatively (not recommended):
-
Remove the .Xauthority file
rm ~someuser/.Xauthority
-
-