Setting up the root password is a mandatory part of the Red Hat Enterprise Linux 7 / CentOS 7installation.
If you forget or lose your password, it is possible to reset it. Now it is known as Rescue Mode / Emergency mode in CentOS / RHEL 7, Previously in RHEL / CentOS 5/6 It was “Single User Mode”.
Note: In GRUB 2, resetting the password is no longer performed in single-user mode as it was in GRUB included in Red Hat Enterprise Linux 6. The root password is now required to operate in single-user mode as well as in emergency mode.
Process: Resetting the Root Password
Please follow this procedure carefully, any mistake can make your system / Linux unstable, Perform this own your on risk.
Start the system and, on the GRUB 2 boot screen, press the e key for edit.
Add the following parameter at the end of the linux line, or linuxefi on UEFI systems (In case of VMWare like KVM or VirtualBox use rb.break instead of init=/bin/sh):
The Linux kernel will run the /bin/sh shell rather than the system init daemon. Therefore, some functions may be limited or missing.
The rhgb and quiet parameters must be disables in order to enable system messages.
Press Ctrl+x to boot the system with the parameter.
The shell prompt appears.
The file system is mounted read-only. You will not be allowed to change the password if the file system is not writable.
To remount the file system as writable, run the mount -o remount, rw / command.
Run the passwd command and follow the instructions displayed on the command line to change the root password.
Note that if the system is not writable, the passwd tool fails with the following error:
Authentication token manipulation error
To make sure that SELinux context of the files that were modified is restored properly after boot, run
Run the exec /sbin/init command to resume the initialization and finish the system boot.
Running the exec command with another command specified replaces the shell and creates a new process; init in this case.
Alternatively, if you wish to reboot the system, run the exec /sbin/reboot command instead.
Enjoy RHEL 7 🙂 Enjoy CentOS 7 🙂 Enjoy Linux 🙂 Enjoy Open Source 🙂
Today I was trying to learn and know about Systemd. I have found one of the great Article about firewalld, Sharing with you guys, It will help you to understand this biggest and major change in RHEL and CentOS 7.
This article is not mine, I found on internet and felt that this is wonderful Article so Sharing with you all, Thanks to Original author, Given credit to him at the end of article.
Firewalld is the new userland interface in RHEL 7. It replaces the iptables interface and connects to the netfilter kernel code. It mainly improves the security rules management by allowing configuration changes without stopping the current connections.
To know if Firewalld is running, type:
# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: active (running) since Tue 2014-06-17 11:14:49 CEST; 5 days ago
# firewall-cmd --state
Note: If Firewalld is not running, the command displays not running.
If you’ve got several network interfaces in IPv4, you will have to activate ip_forwarding.
To do that, paste the following line in the /etc/sysctl.conf file:
Note1: Type –remove-service=http to deny the http service.
Note2: The firewall-cmd –reload command is necessary to activate the change. Contrary to the –complete-reload option, current connections are not stopped.
To get the list of services in the default zone, type:
# firewall-cmd --list-services
Note: To get the list of the services in a particular zone, add the –zone= option.
Service firewall configuration
With the Firewalld package, the firewall configuration of the main services (ftp, httpd, etc) comes in the /usr/lib/firewalld/services directory. But it is still possible to add new ones in the /etc/firewalld/services directory. Also, if files exist at both locations for the same service, the file in the /etc/firewalld/services directory takes precedence.
For example, it is the case of the HAProxy service. There is no firewall configuration associated.
Create the /etc/firewalld/services/haproxy.xml and paste the following lines:
If your firewall is your network gateway and you don’t want everybody to know your internal addresses, you can set up two zones, one called internal, the other external, and configure masquerading on the external zone. This way, all packets will get your firewall ip address as source address.
To set up masquerading on the external zone, type:
# firewall-cmd --zone=external --add-masquerade
Note1: To remove masquerading, use the –remove-masquerade option.
Note2: To know if masquerading is active in a zone, use the –query-masquerade option.
In addition to the masquerading, you can want to use port forwarding.
If you want all packets intended for port 22 to be now forwarded to port 3753, type:
Note1: To remove port forwarding, use the –remove-forward-port option.
Note2: To know if port forwarding is active in a zone, use the –query-forward-port option.
Also, if you want to define the destination ip address, type: