RedHat Linux Commands
RedHat Linux Commands
mkdir The mkdir command is used to create a new directory mkdir <dir name>
under any directory.
rmdir The rmdir command is used to delete a directory. rmdir <dir name>
touch The touch command is used to create empty files. We touch <file name>
can create multiple empty files by executing it once. touch <file1> <file2>
cat The cat command is a multi-purpose utility in the cat <file name>
Linux system. It can be used to create a file, display
content of the file, copy the content of one file to
another file, and more.
useradd The useradd command is used to add or remove a useradd <user name>
user on a Linux server.
passwd The passwd command is used to create and change passwd <user name>
the password for a user.
groupadd The groupadd command is used to create a user1. groupadd <group name>
group.
Run-level Description
0 System halt i.e., the system can be safely powered off with no activity.
Multiple user modes under the command line interface and not under the
4 User-definable.
Multiple user mode under GUI (graphical user interface) and this is the
Syntax:
init <runlevel_value>
telinit <runlevel_value>
Owner permissions − The owner's permissions determine what actions the owner of the
file can perform on the file.
Group permissions − The group's permissions determine what actions a user, who is a
member of the group that a file belongs to, can perform on the file.
Other (world) permissions − The permissions for others indicate what action all other
users can perform on the file.
$ls -l /home/amrood
Changing Permissions
To change the file or the directory permissions, you use the chmod (change mode) command.
There are two ways to use chmod — the symbolic mode and the absolute mode.
$ls -l testfile
$ls -l testfile
$ls -l testfile
The second way to modify permissions with the chmod command is to use a number to specify each set of
permissions for the file.
c = Char
b = block drwx-rx-rw
d = dir Other user Permission
Changing Owners and Groups
Two commands are available to change the owner and the group of files −
chown − The chown command stands for "change owner" and is used to change the
owner of a file.
chgrp − The chgrp command stands for "change group" and is used to change the
group of a file.
SELinux Modes
1. Enforcing mode. The default and most secure SELinux mode. In this mode, SELinux
enforces the access control policies set by the sysadmin and does not allow users to
override them. If a user or process attempts to access a resource not authorized by the
policies, SELinux denies the request and logs the decision in AVC.
2. Permissive mode. Less secure than enforcing mode but still provides protection. In this
mode, SELinux does not enforce the policies but logs events when a user or process
attempts to access a resource blocked off by the policies. This enables sysadmins to
monitor the system for potential security issues and make any necessary policy changes
before authorizing the enforcing mode.
3. Disabled mode. The least secure mode as it does not protect system resources. In this
mode, SELinux does not enforce access control policies. This mode is useful for testing
or debugging.
# vim /etc/selinux/config
Set the SELINUX variable to permissive with:
*you have been provided a virtual box named as serverX.example.com (hint:where X is your
domain number) * password for both virtual machine should be "Postroll"
*serverX.example.com provided with ip=172.25.X.11/255.255.255.0 *serverX.example.com
are provided with gateway 172.25.254.254 & example.com dns domain with the IP:
172.25.254.254
*NOTE: I have Foundation Machine # 9, so I am using 172.25.9.11
# nmcli connection add con-name eth0 ifname eth0 type ethernet ip4 172.25.9.11/24 gw4
172.25.254.254
# nmcli connection modify eth0 ipv4.dns 172.25.254.254
# nmcli connection modify eth0 ipv4.dns-search example.com
# nmcli connection modify eth0 ipv4.method manual
# nmcli connection modify eth0 connection.autoconnect yes
# nmcli connection down eth0 # nmcli connection up eth0