Disk Options in The Linux
Disk Options in The Linux
Kali Linux uses the Linux kernel, which is the core of the operating system that
manages the hardware and provides basic services for the user programs. The kernel
version of Kali Linux depends on the release and the image you download. For
example, the latest Kali Linux 2023.3 release has kernel version 6.3.0
b. Package Manager:
Kali Linux uses the Advanced Package Tool (APT) as its package manager. APT is a
command-line tool that allows you to install, update, and remove software packages on
your system. APT also handles dependencies, meaning that it automatically installs or
removes any additional packages that are required or no longer needed by the software
you install or remove
Screenshots:
2 - CLO4 - Configuration of Linux Hard disks
To add a second hard disk to your Linux server and configure it as described, you can follow
these steps. Assuming the second hard drive is recognized as /dev/sdb, please make sure to
replace it with the correct device name if it differs on your system:
Identify the second hard drive (e.g., /dev/sdb). It may show up as something like
/dev/sdb, /dev/sdc, etc.
2. Create a Single Partition:
Use the fdisk or parted command to create a single partition on the second hard
drive. In this example, we'll use fdisk:
Command: sudo fdisk /dev/sdb
1. Type n to create a new partition.
2. Choose the default partition number.
3. Accept the default first sector by pressing Enter.
4. Specify the last sector as the full size of the drive. You can do this by pressing Enter
again to accept the default value.
5. Type w to write the changes and exit.
Mount the newly formatted partition to the mount point you created:
7. Set Permissions:
You may need to adjust the permissions on the mount point so that all users can
access it. For example, to make it accessible to all users, you can set the
permissions to 755:
Command: sudo chmod 755 /company_data
Additionally, you can change the ownership of the directory to a suitable group:
Command: sudo chown -R youruser:yourgroup /company_data
Replace youruser and yourgroup with appropriate values.
8. Verify:
You can verify that everything is set up correctly by unmounting and then
remounting the partition:
sudo mount -a
Now, your second hard drive should be added, partitioned, formatted with the ext4 file
system, and mounted to the /company_data directory, accessible by all users.
3 - CLO4 - Managing user and group accounts
To manage user and group accounts on a Linux system, you can follow these steps to create
the required user groups and user accounts as described:
You can create the two user groups, one for managers and one for consultants,
using the groupadd command. Replace "managers_group" and
"consultants_group" with suitable group names
For each of the two managers, you can use the useradd command to create user
accounts and add them to the "IT_Manager" with the -g option to specify the
primary group. Replace "manager1" and "manager2" with the usernames and
"Manager One" and "Manager Two" with their full names:
The -m option is used to create the user's home directory, and the -c option
specifies the user's full name.
Similarly, for the consultants, you can use the useradd command to create user
accounts and add them to the "consultants_group" as their primary group. Replace
"consultant1" and "consultant2" with the usernames and "Consultant One" and
"Consultant Two" with their full names:
4. Set Passwords:
To set passwords for these user accounts, use the passwd command. Replace "username"
with the actual username:
You can verify the group assignments and user account creation by checking
the /etc/passwd file to ensure that the default groups are correctly set. Additionally, you
can use the groups command to check group memberships for users:
Commands: groups manager1
groups manager2
groups consultant1
groups consultant2
1. Create Directories:
You can create the required directories using the mkdir command. Make
"managers_data" and "consultants_data” directory names:
Commands: sudo mkdir /company_data/managers_data
sudo mkdir /company_data/consultants_data
2. Set Permissions:
To configure the permissions as described, you can use the chmod and chown
commands. First, ensure the ownership and group ownership are set correctly:
g+rwX adds read and write permissions for the group, and the X ensures that
group members can enter and access the directory.
To set a static IP address for your Linux server, you will typically need to
modify the network configuration files. The location of these files can vary
depending on your Linux distribution. Commonly used files include
/etc/network/interfaces for Debian-based systems or /etc/sysconfig/network-
scripts/ifcfg-<interface> for Red Hat-based systems.
Inside the file, you can set the static IP address, subnet mask, gateway, and
DNS servers. For example:
Save the file and then restart the network service:
3. Ping Operations:
-a: To make the ping results audible, you can use the -a option.
-c count: To set the number of pings, use the -c option. For example, to send 5
Pings
Command: ping -c 5 <destination>
-i interval: To set the time between pings, use the -i option. For example, to
set a 1-second interval
Command: ping -i 1 <destination>
-s size: To set the packet size, use the -s option. For example, to send packets
of 100 bytes
Command: ping -s 100 <destination>
To ping the loopback interface (127.0.0.1) with these options:
Command: ping -a -c 5 -i 1 -s 100 127.0.0.1
4. Netstat Command:
You can use the netstat command to show the current TCP/IP network status.
Some useful options for netstat include:
Install vsftpd on your Linux server. The command may vary depending on
your distribution
2. Configure vsftpd:
Edit the vsftpd configuration file to allow local users to access their home
directories. Open the configuration file with a text editor:
Command: sudo nano /etc/vsftpd.conf
Modify or add the following lines in the configuration file to enable local user
access and restrict them to their home directories:
Lines: local_enable=YES
write_enable=YES
local_umask=022
chroot_local_user=YES
allow_writeable_chroot=YES
3. Restart vsftpd:
You can test the FTP server functionality locally from the same computer
using the ftp command. Open a terminal and run:
To test your FTP server from another machine (e.g., Windows or another
Linux system), you'll need an FTP client. Popular FTP clients for Windows
include FileZilla and WinSCP.
FileZilla:
Open FileZilla.
Enter the IP address or hostname of your Linux server.
Use the FTP protocol, and choose "Use explicit FTP over TLS if available."
Enter your username and password.
Connect to the server.
You can test the FTP server with options for specific information using netstat:
Command: netstat -l -p
Command: netstat -s -t
7 - CLO5 - Configuring and Managing httpd Service
To configure and manage the Apache HTTP server (httpd) service on your Linux
machine, follow these steps
To stop and start the Apache HTTPd service, use the systemctl command:
To ensure that the Apache HTTPd service starts automatically at system boot,
use the following commands:
After running these commands, Apache HTTPd will start on system boot.
This command will provide information about the service's status and whether
it's active and running.
To log in to the SSH server remotely and create a file in the user's home
directory, you can use the ssh command. Replace remote_user with the
username on the remote machine and remote_server with the remote server's
IP address or hostname:
Command: ssh remote_user@remote_server
After logging in, you can create a file in the user's home directory:
Command: touch sshfile.txt
To view the current default policy for incoming and outgoing traffic, use the
following command:
To set the default policy to drop all forwarding connections, use the following
command:
To drop incoming SSH requests (assuming SSH runs on the default port 22),
use the following rule:
Verify this by attempting to connect to the Linux server through SSH from
another machine. You should not be able to establish a connection.