Showing posts with label redhat. Show all posts
Showing posts with label redhat. Show all posts

Thursday, November 24, 2016

How to Open TCP and UDP ports using firewall-cmd on CentOS/RedHat/Fedora

This post is about how to open specific tcp and udp ports using the command firewall-cmd. So without further due, let's get started.



Opening TCP ports:

Let's say, I want to open the tcp ports 80 and 443 which are used by http and https protocol respectively.

To do that, run the following commands,

firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp


Opening UDP ports:

Let's say, I want to open the udp port 53, which is used by bind dns service.

To do that, run the following command,

firewall-cmd --permanent --add-port=53/udp

Reload the Configuration:

Now we have to reload firewall-cmd configurations. To do that, run the following command,

firewall-cmd --reload

Verification:

To verify that the commands worked, let's view the current opened port list,

firewall-cmd --list-ports 443/tcp 80/tcp 53/udp

Tested on: CentOS 7

View Information(Description and Required Packages) of a group using yum

In one of my earlier post, I wrote about finding available software groups on CentOS/RedHat/Fedora. But you might not know what each of these group is for, what packages it will install and stuff like that. This is the topic of this post.

Let's say I want to know more about the group "Basic Web Server". To view the information, run the following command,

yum groups info "Basic Web Server"

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

Environment Group: Basic Web Server
 Environment-Id: web-server-environment
 Description: Server for serving static and dynamic internet content.
 Mandatory Groups:
   +base
   +core
   +web-server
 Optional Groups:
   +backup-client
   +debugging
   +directory-client
   +guest-agents
   +hardware-monitoring
   +java-platform
   +large-systems
   +load-balancer
   +mariadb-client
   +network-file-system-client
   +performance
   +perl-web
   +php
   +postgresql-client
   +python-web
   +remote-system-management
   +web-servlet

That's it.

Tested on: CentOS 7

Install a group of packages on CentOS/RedHat/Fedora using yum

In the previous post, I wrote about how to find the available software/package groups on CentOS/RedHat/Fedora OS using yum. But how do we install a group? I will show you how to install a group of packages with yum.

Let's say we want to install a minimal graphical user interface (GUI) on our server. So the group to install for that is, "Server with GUI".

To install this group, run the following command,

yum groups install "Server with GUI"

It should work. Thank you.

Tested on: CentOS 7

Saturday, October 15, 2016

Unlock User Account (Enable User Login) on Linux

To unlock a user account that has been locked on linux, you can use the passwd command.

The command is,

sudo passwd -u username

For example, to unlock the user 'linda', so 'linda' can login to the system again,

sudo passwd -u linda
Unlocking password for user linda.
passwd: Success

Now you can try to login as 'linda' and you will see that login is working again.

Disable User Login (Lock Password) on Linux

To lock a user account on linux, you can use the passwd command.

The command is,

sudo passwd -l username

For example, to lock the user 'linda', so 'linda' can not login to the system anymore,

sudo passwd -l linda
Locking password for user linda.
passwd: Success

Now you can try to login as 'linda' and you will see that you login is disabled.