Delete files/folders on OES11 – Permission denied

While deleting files/folders on the NSS volume on an OES11 server as root user via shell. Let’s say test1.doc and the following error will occur:

“rm: cannot remove `test1.doc’: Permission denied” or “S-1-1-0-1 on a Windows machine.”

You will get that error if you have flagged the file with NSS flag “Delete Inhibit” or “Rename Inhibit”. Clear those flags out and it should also be possible to delete the file directly from a Linux console. Use this command:

root# attrib -r -c all foldername

generic – Postfix generic table format

It has been taken from man – an interface to the on-line reference manuals.

The following shows a generic mapping with an indexed file. When mail
is sent to a remote host via SMTP, this replaces his@localdomain.local
by his ISP mail address, replaces her@localdomain.local by her ISP mail
address, and replaces other local addresses by his ISP account, with an
address extension of +local (this example assumes that the ISP supports
“+” style address extensions).

/etc/postfix/main.cf:
smtp_generic_maps = hash:/etc/postfix/generic

/etc/postfix/generic:
his@localdomain.local hisaccount@hisisp.example
her@localdomain.local heraccount@herisp.example
@localdomain.local hisaccount+local@hisisp.example

Execute the command “postmap /etc/postfix/generic” whenever the table
is changed. Instead of hash, some systems use dbm database files. To
find out what tables your system supports use the command “postconf -m”.
Continue reading “generic – Postfix generic table format”

Copy data from NSS to NSS with rights

This command “migfiles” copy data from the NSS volume DATA01:SLX on the source server with the IP address 171.16.12.56 to the tmp directory on the NSS volume DATA01 with verbose output:

root@nbsuse13:DATA01# migfiles -s 172.16.12.146 -V DATA01:SLX -x /media/nss/DATA 01/tmp -i
Enter the username (e.g cn=admin,o=mycompany)
for the server 172.16.12.146: cn=admin,ou=group,o=newbridge
Enter cn=admin,ou=group,o=newbridge password:
Enter the username (e.g root)
for the server : root
Enter root password:
Information: Source volume type is NSS
Information: Given destination path is NSS
Information: Copying /media/nss/DATA01/SLX/ to /media/nss/DATA01/tmp/
Information: Copying /media/nss/DATA01/SLX/a/ to /media/nss/DATA01/tmp/a/
Information: Copying /media/nss/DATA01/SLX/B/ to /media/nss/DATA01/tmp/B/
root@nbsuse13:DATA01#

Useful RPM Commands

Getting detailed information about the package telnet:
root# rpm -qi telnet
Name : telnet
Epoch : 1
Version : 0.17
Release : 59.el7
Architecture: x86_64
Install Date: Thu 16 Jul 2015 13:49:27 IST
Group : Applications/Internet
Size : 115772
License : BSD
Signature : RSA/SHA256, Fri 04 Jul 2014 06:12:17 IST, Key ID 24c6a8a7f4a80eb5
Source RPM : telnet-0.17-59.el7.src.rpm
Build Date : Mon 09 Jun 2014 23:06:27 IST
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem
Vendor : CentOS
URL : http://web.archive.org/web/20070819111735/www.hcs.harvard.edu/~dholland/computers/old-netkit.html
Summary : The client program for the Telnet remote login protocol
Description :
Telnet is a popular protocol for logging into remote systems over the
Internet. The package provides a command line Telnet client
root#

Determining which package installed the file /usr/bin/telnet:
root# rpm -qf /usr/bin/telnet
telnet-0.17-59.el7.x86_64
root#

Showing all the files installed by the package telnet:
root# rpm -ql telnet
/usr/bin/telnet
/usr/share/doc/telnet-0.17
/usr/share/doc/telnet-0.17/README
/usr/share/man/man1/telnet.1.gz
root#

Viewing the documentation files for the command telnet:
root# rpm -qd telnet
/usr/share/doc/telnet-0.17/README
/usr/share/man/man1/telnet.1.gz
root#

Booting to Emergency Mode

Emergency mode provides the most minimal environment possible and allows you to repair your system even in situations when the system is unable to enter rescue mode. In emergency mode, the system mounts the root file system only for reading, does not attempt to mount any other local file systems, does not activate network interfaces, and only starts few essential services. In Red Hat Enterprise Linux 7, emergency mode requires the root password.
As soon as the boot process starts, press ESC to bring up the GRUB 2 boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB 2 boot prompt. You will see GRUB 2 boot prompt – press “e” to edit the first boot option. Find the kernel line linux16 or linuxefi or linux (Each menuentry block that represents an installed Linux kernel contains linux on 64-bit IBM POWER Series, linux16 on x86_64 BIOS-based systems, and linuxefi on UEFI-based systems. Then the initrd directives followed by the path to the kernel and the initramfs image respectively) and add systemd.unit=emergency.target at the end of the line and then press CTRL-X to boot. System will boot and you will see the root prompt. Parameters, 1, s, and single, can be passed to the kernel as well.

Emergency Mode:
systemd.unit=emergency.target

It should look like this one:
–cut
1:
2: linux16 /vmlinuz-3.10.0-229.7.2.e17.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=en_IE.UTF-8 systemd.debug systemd.unit=emergency.target
3: initrd16 /initramfs-3.10-0-229.7.2.el7.x86_64.img
4:
–cut

Booting to Rescue Mode

Rescue mode provides a convenient single-user environment and allows you to repair your system in situations when it is unable to complete a normal booting process. In rescue mode, the system attempts to mount all local file systems and start some important system services, but it does not activate network interfaces or allow more users to be logged into the system at the same time. In Red Hat Enterprise Linux 7 and CentOS 7, rescue mode is equivalent to single user mode and requires the root password.
As soon as the boot process starts, press ESC to bring up the GRUB 2 boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB 2 boot prompt. You will see GRUB 2 boot prompt – press “e” to edit the first boot option. Find the kernel line linux16 or linuxefi or linux (Each menuentry block that represents an installed Linux kernel contains linux on 64-bit IBM POWER Series, linux16 on x86_64 BIOS-based systems, and linuxefi on UEFI-based systems. Then the initrd directives followed by the path to the kernel and the initramfs image respectively) and add systemd.unit=rescue.target at the end of the line and then press CTRL-X to boot. System will boot and you will see the root prompt. Parameters, 1, s, and single, can be passed to the kernel as well.

Rescue Mode:
systemd.unit=rescue.target

It should look like this one:
–cut
1:
2: linux16 /vmlinuz-3.10.0-229.7.2.e17.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=en_IE.UTF-8 systemd.debug systemd.unit=rescue.target
3: initrd16 /initramfs-3.10-0-229.7.2.el7.x86_64.img
4:
–cut

Boot Single User Mode – Resetting forgotten root user account password in RHEL/CentOS 7

As soon as the boot process starts, press ESC to bring up the GRUB boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB boot prompt. You will see a GRUB boot prompt – press “e” to edit the first boot option. Find the kernel line linux16 or linuxefi or linux (Each menuentry block that represents an installed Linux kernel contains linux on 64-bit IBM POWER Series, linux16 on x86_64 BIOS-based systems, and linuxefi on UEFI-based systems. Then the initrd directives followed by the path to the kernel and the initramfs image respectively) and add init=/bin/sh at the end of the line and then press CTRL-X to boot.
System will boot and you will see the root prompt. Type mount -rw -o remount / and then passwd to change the root password and then touch /.autorelabel and then exec /sbin/init

In short:
init=/bin/sh – In case of VMWare like KVM or VirtualBox use rb.break instead of inti=/bin/sh
# mount -o remount,rw /
# passwd root
[Enter New Password]
[Re-enter New Password]
# touch /.autorelabel
# exec /sbin/init

It should look like this one:
–cut
1:
2: linux16 /vmlinuz-3.10.0-229.7.2.e17.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=en_IE.UTF-8 systemd.debug init=/bin/sh
3: initrd16 /initramfs-3.10-0-229.7.2.el7.x86_64.img
4:
–cut

Use the iptables and ip6tables services instead of firewalld – CentOS 7

To use the iptables and ip6tables services instead of firewalld, first disable firewalld by running the following command as root:

root# systemctl disable firewalld
root# systemctl stop firewalld

Then install the iptables-services package by entering the following command as root:

root# yum install iptables-services

The iptables-services package contains the iptables service and the ip6tables service.
Then, to start the iptables and ip6tables services, run the following commands as root:

root# systemctl start iptables
root# systemctl start ip6tables
root# systemctl enable iptables
root# systemctl enable ip6tables

An example script which blocks INPUT and FORWARD and runs /sbin/iptables-save and writes the current iptables configuration to /etc/sysconfig/iptables. Upon reboot, the iptables init script reapplies the rules saved in /etc/sysconfig/iptables by using the /sbin/iptables-restore command.

Continue reading “Use the iptables and ip6tables services instead of firewalld – CentOS 7”

How to install RHEL EPEL repository on Centos 7.x or RHEL 7.x

The following instruction assumes that you are running command as root user on a CentOS/RHEL 7.x system and you would like to use Fedora Epel repositories.

Install Extra Packages for Enterprise Linux repository configuration (recommended). Just type the following command on a CentOS 7 or RHEL 7:

root# yum install epel-release

or

Install the extra EPEL repositories from dl.fedoraproject.org :


root# cd /tmp
root# wget https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
root# ls *.rpm
root# rpm -i epel-release-7-5.noarch.rpm