0% found this document useful (0 votes)
44 views18 pages

File Server Group 3

file server

Uploaded by

Kutemwa Mithi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views18 pages

File Server Group 3

file server

Uploaded by

Kutemwa Mithi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

MALAWI UNIVERSITY OF SCIENCE AND TECHNOLOGY

SERVER ADMINISTRATION
LECTURER: P. MALIWICHI
(FILE SERVERS)

GROUP THREE MEMBERS


CHISOMO NAZOMBE (BIT‐024‐18)
NDAGHA KANG’OMA (CIS‐025‐19)
ABEL TCHONGWE (CIS‐038‐19)
ROBERT MANENO (BIT‐030‐19)
VICTORIA KASOTI (CIS‐009‐19)
JAPHET NJIKHO (CIS‐032‐19)
MODESTER PHIRI (BIT‐014‐19)
Introduction to file servers

- A file server is a computer containing files available to all users connected to a local
area network (LAN).
- A file server typically contains large amount of storage space and is connected to a
network, allowing users to access and share files from various devices.
- File servers can be used in a variety of settings such as businesses, educational
institutions, home networks and government agencies to share and store files like
documents, images, videos and other digital content. Administrators have full
control over who can access which files and what actions they can perform.
- Some file servers also include features such as backup and recovery tools, remote
access capabilities and collaboration tools, which allow users to work on files
together in real‐time.
File Transfer Protocol (FTP) is an example of a file server designed to serve files over the
internet, which allows people to send and receive files.

Functions of file servers


1. To provide centralized storage and management of files for a network of
computers.
2. File storage and retrieval.
3. File sharing and collaboration.
4. Security and access control.
5. Remote access.
How does File server work?

A file server is a computer or storage device that is dedicated to storing, managing, and sharing files
over a network. Think of it as a central hub for file storage that enables users to access and share files
from anywhere on the network.

The way a file server works is quite simple. It involves three main components: the server, the network,
and the client devices.

Firstly, the file server stores files on its hard drive or storage system using a file system to organize and
manage them. The server is connected to a network that enables other devices, such as desktops,
laptops, or mobile devices, to access and share these files.

When a client device requests a file, the server locates the file and sends it back to the client over the
network. The client device can then view or edit the file, and if necessary, save it back to the server. The
file is stored on the server's hard drive or storage system using the file system, which organizes it into a
hierarchical structure for easy access and management.

Multiple users can access and share files on the file server simultaneously, as long as they have the
necessary permissions and are authorized to do so. This enables collaboration among users who may be
working on the same project or document.

Overall, a file server simplifies file sharing and management by centralizing storage, enabling easy access
and sharing of files, and providing a secure and controlled environment for file management.

REQUIREMENTS FOR FILE SERVER TO WORK PROPERLY


A File Server needs efficient hardware to work properly in a safe environment. The hardware
should have enough storage space and processing power to work smoothly with multiple users.
Sufficient working memory and fast processing speed will help multiple users to share, transfer,
and access the data file effortlessly
Security protocols used by file servers

Network File System: NFS acts as a distributed file system that saves data files on a particular
network. This protocol allows users to perform different operations, such as copying or creating
a file and directory through a network.

File Transfer Protocol: FTP is responsible for sending and receiving particular data files through
a secured network. This security protocol is used to access a File Server remotely.

Server Message Block: SMB is compatible with Windows and macOS users. This security
protocol enables the apps on a computer to read or write files. Moreover, it also allows users to
request services from server programs through a local area network.

Advantages of file servers

 File Servers make data transferring simple and secure. You can use it as a central storage
medium where your files or documents are stored safely.
 Along with tackling multiple files easily, the File Server helps with data recovery
efficiently.
 By saving and transferring files to a File Server, you can save storage space in a client
system.
 You can access all the information and data from a File Server remotely with an active
internet connection. Thus, it provides excellent flexibility to the users.

Disadvantages

 To set up and manage a File Server, you would require an expert or IT professional.
 It can be time‐consuming and hectic to monitor a File Server constantly.
How to configure a file server?
The following are steps to configure file server:
1. Installing samba
‐ The following is the command to install samba:
sudo install samba samba‐common‐bin OR sudo apt install samba

‐ This command installs the samba package and its dependencies on the ubuntu
system, allowing one to share files and printers with windows clients using the SMB
protocol. The “samba‐common‐bin” refers to the package name for samba common
utilities, which includes command‐line tools such as ‘smbclient’ and ‘testparm’

2. Creating a shared folder


‐ This folder is where one puts everything one wants to be accessible over the
network.
‐ The following is the command used to create the folder: sudo mkdir ‐m 1777
/share. (You can replace “/share” with the name you want for the new folder.)

‐ The command creates a new directory called group3 in the root directory with
the permission mode set to “1777”, allowing anyone to write to and execute the
directory, and any files or directories created within it will have the sticky bit set.
‐ You can also change the permissions for the created folder by typing this
command: sudo chmod ‐R 1777 /share
‐ The command changes the permission mode of the directory, and any files or
directories created within it. The ‐R option recursively applies the permission to
all files and subdirectories under group3 folder
3. Editing the samba configuration
‐ To edit the configuration file: sudo nano /etc/samba/smb.conf
‐ The command nano is used to edit, etc is the directory that contains
configuration files, samba it’s the name of the folder and smb.conf it’s the name
of the configuration file.
‐ Appending the below lines on the bottom of the configuration file
The interpretation of the above lines
[group3]: means the name of the shared folder and should be unique name.
Path: This is the path for the newly created directory.
Public: It should be accessed only by the users that have been created.
Valid users: The users who have been created
Read only: A Boolean value that specifies whether users can write to the shared
folder.
Write lists: contain all users that have been assigned to have write privileges
Browsable: A Boolean value that specifies whether the shared folder should be
visible in the list of shared folders when browsing the network.
Force user: used when legible user is being denied to access the folder. This
attributes to avoid this by allowing the user to login.
4. Creating users
‐ The users will be able access the directory that we have created. So, Samba has
its own users and databases, that it uses to manage its users.
‐ So, the command to create the user is: sudo smbpasswd ‐a user_name.

5. Restarting the server


‐ The following are the commands to restart the server:

a. Restarting the samba daemon(service)

b. Restarting the samba network services

c. Enabling the services for samba services and network


HOW TO TEST IF THE SERVER IS WORKING
1. By testing connectivity
To test if your Samba server is reachable from another machine on the network you may use
“ping” command. The "ping" command sends an ICMP echo request to the IP address of the
machine you are trying to reach, and if the machine responds with an ICMP echo reply, then
you know that samba server is reachable on the network.
To know the IP address of your Samba server, you can use the hostname ‐ I command in the
terminal of your Linux server. These command display IP addresses assigned to your server.

To use the "ping" command to test if your Samba server is reachable, you can simply run the
following command on the same or another machine on the same network:

If you get a response from the server, then it is reachable on the network.

2. Connecting to the server


To test if your Samba configuration is working properly, you can also try to connect to the
server and see if you can access the shared files or folders using a Windows‐based computer.
Open "File Explorer" on the windows computer, and in the address bar type the following:

If everything is configured properly, you should be able to see the shared folders as below

Then you will need to provide valid credentials in order to access the shared folder. When you
try to access the shared folder, you should be prompted to enter a username and password.
You will need to provide a username and password that has access to the shared folder. These
credentials must be valid on the Samba server.
After providing valid credentials to access the Samba folder, you should be able to access the
folder and its contents. Depending on the permissions configured on the folder, you may be
able to read, write, and modify files and folders within the folder.
For example, after providing the credentials we were able to create a folder named ‘kwithu’ in
our group 3 folder.
20 COMMONLY USED LINUX COMMANDS
To work with Linux efficiently, it's important to have a good understanding of the most commonly used
Linux commands. This section introduces some of the most commonly used Linux commands

1. ls
The “ls” command is used to list the files and directories in the current working directory or in a
specified directory. Using the “ls” command without any arguments lists the contents of the
current working directory this is shown in the figure below:

The “ls” command when used together with the argument “‐a” can be used to show the hidden
files and directories in a directory. This is shown in figure below:

“ls” command when used together with the argument “‐l” can also to provide further file or
directory information along with the directories and files names in a specified directory or
current working directory. It can provide information regarding file or directory permissions,
number of links, ownership, group, file size and modification date this is shown in figure below:

2. cd
The cd stands for ‘change directory’ and it is used to navigate through directories. The figures
below show some of the use cases of the command:
To move into a subdirectory that is one level below a user can show the code shown in figure
below:

To move back to the previous working directory a user can use code below:

To move back to a parent directory a user can use code shown in figure below:
3. pwd
The “pwd” command stands for (Print Working Directory) and when typed into a terminal it
prints out the current working directory. This can be significant in verifying what directory the
user is in when performing tasks. The output of this command is the absolute path of the
current working directory. The usage of this command is shown in figure below:

4. mkdir
The “mkdir” stands for ‘make directory’ and it is used to create an empty directory in the
current directory. Figure below shows two ways in which this command can be used in the first
case we are just creating a simple empty directory. In the second case we are creating a parent
directory using ‘‐p’ and other subdirectories. This can be a useful trick to save time.

5. rm
In Linux, the rm command is used to delete files or directories. It can also remove folders and
their contents recursively when used with the ‐r option. The rm command differs from rmdir
command. The rmdir command is used to remove only empty directories. If a directory contains
any files or subdirectories, the rmdir command will fail with an error message. To delete a non
empty directory with its all files and subdirectories the “rm ‐r “ command is used followed by
the directory name. However one should be cautious when using this command because it
deletes all the specified files or directories recursively and one might not be able to cover them.
Figures below show usage of ‘rm’ and how it differs from a ‘rmdir’ command.

6. cp
The “cp” command in Linux is used to copy files or directories from one location to another. The
basic syntax of a “cp” command is as follows: “cp [options] source destination” here the source
is the file or directory you want to copy and the destination is where you want to copy to.
Figure below shows we are copying file1.txt to file4.txt. “cp” can create the destination file if it
does not exist in the directory this was the case here. And we verified that it has indeed been
created and the copy was successful.
“cp” command overwrites the contents of the destination we can use “‐I” in the [options] to
prompt the user for confirmation before overwriting an existing file this is shown in figure
below:

7. mv
The “mv” command is used to move or rename files and directories. The basic syntax of it is: mv
[options] source destination. here the source is the file or directory you want to move or
rename and the destination is where you want to move to or the new name of a file or directory
if you want to rename it. Figure below shows renaming of a file file5.txt to renamedfile.txt.

Figure below shows moving of renamedfile.txt to a directory myfiles/

Here the “mv” command copies the contents of file1.txt to file2.txt it overwrites the contents of
file2.txt and renames it to file2.txt.

8. cat
The “cat” is used to concatenate files and display the output on the terminal. To concatenate
two files and display the output on the terminal the command can be used as shown in figure
below:

The “cat” command can also be used to concatenate specified files in the current directory and
display the output on the terminal. The figure below shows how a “cat” command can be used
to concatenate all text files in the current directory and display output on the terminal.

The figure below shows how a “cat” command can be used to concatenate all the text files in a
current directory and copy the result to ‘file6.txt’ but it performs an overwrites it. The ‘‐n’
argument is used to display line numbers on the output on the terminal.
Figure below shows how the “cat” command can be used to concatenate the contents of two
files ‘file3.txt’ and ‘file2.txt’ and copy the result to ‘file7.txt’ but it overwrites it. After that the
‘cat’ command is used to verify that indeed the previous operation was successful.

9. chmod
The “chmod” command stands for “change mode” and it is used to change permissions of files
and directories. In Linux permissions determine who can access a file or directory and what kind
of actions they can perform on it such as read, write or execute. The basic syntax of the
“chmod” is as follows: chmod [options] mode file1 file2 … Here mode refers to the new
permissions that you want to set for the files and directories. ‘file1’ , ‘file2’ and so on refer to
the files or directories that you want to modify. Multiple files or directories can be specified
here. The ‘mode’ argument can be specified in one of two ways: a. Using symbolic notation
which is the most common way to specify permissions. The symbolic notation consists of three
parts: who the permission applies (owner, group or others), what kind of permission is being
set(read , write or execute) and whether the permission is being added, removed or set
explicitly. The command chmod u+rwx filename.txt can be used to give (specified by +) the
owner(u) of the file read (r), write(w) and execute(x) permissions. Another way of specifying
permission is by using numeric notation and it consists of three digits where each digit specifies
the permissions for the owner, group and others. Here 0 = no permission , 1 = execute
permission , 2 = write permission , 3 = write and execute , 4 = read , 5 = read and execute , 6 =
read and write , 7 = read , write and execute permission. To give owner and group of a
directory full permissions and all others no permission one can use chmod 770 mydir. The
figures below show how “chmod” command can be used . Firstly an empty file named
“my_file.txt” was created. Next the ls ‐l my_file.txt command was used to view file permissions
for the ‘my_file.txt’ file. Here the owner and group has read and write permissions (‘rw‐‘) while
everyone else only has read permission (‘r‐‐‘). Now the “chmod” command was used to change
file permission where we gave the owner of the file read, write and execute permissions and
everyone else no permission (chmod 700 my_file.txt).

Now the owner tried to perform some actions including adding data to the file which were
successful.

After that we changed the file permission using chmod 555 my_file.txt . Now we try to read the
file this is successful however when we try to write to the file we get an error because the
permission now only allows the owner does not have write permission. This is shown in figure
below:
10.ps
The “ps” command is used in Linux to display information about the active processes on a
system. It can be used to list all processes running on the system along with information about
their user, process ID (PID), parent process ID(PPID), CPU usage, memory usage and more.
Figure below shows usage of “ps” command in a linux terminal:

11.ssh
“ssh” command is used to establish a secure shell (SSH) connection to a remote server or device.
This command allows you to securely log in and execute commands on a remote system as if
you were physically sitting at the machine. Here we tested on our local machine where we were
able to log in to through SSH. This is shown in figure below:

12.nano
“nano” is a command‐line text editor for Linux which can be used to create new files, open
existing files and edit files. To open an existing file named “nanodemo.txt” a user can use the
following command in the terminal :

This will open nano where a user can work with the file. The figure below shows an opened file
in nano editor.

13.ping
“ping” is used to troubleshoot computer networks. It tests the reachability of a host on an IP
network, as well as the round‐trip time for packets sent from source host to destination host.
“ping” works by sending Internet Control Message Protocol (ICMP) echo request to target host
and waits for an ICMP echo reply in response. The figure below shows a basic “ping” command
in use where we ping google.com and we see that we have established a relatively good
connection.
14.chown
The “chown” command is used to change the user and or group ownership of a file or directory.
Here the user “ndagha” created a file ‘testfile.txt’ but later the file was changed ownership to
user change. The ownership change was verified using the command ‘ls ‐l testfile.txt’. Figure
below depicts this:

By default, the owner of a file has read, write and execute permissions. In addition to these
basic privileges, the owner of a file can also perform certain administrative tasks, such as:
changing the file’s permissions, changing file’s ownership, renaming, deleting and moving files.
These privileges give the file owner significant control over the file and can be useful for
managing file permissions and access control on a Linux system so the ”chown” is a very
powerful tool and should be used carefully.
15.tar
The tar command is used in Linux to create and manipulate compressed archive files. The basic
syntax is ‘tar [OPTIONS] [FILENAMES]’. Here the ‘[OPTIONS]’ refer to any additional parameters
you want to specify such as specifying compression format or setting file permissions. And the
‘[FILENAMES]’ refer to the files and directories you want to include in the archive. The common
options are ‘‐c’ which is used to create a new archive file, ‘‐z’ which is used to specify ‘gzip’
compression and ‘‐j’ which is used to specify ‘bzip2’ compression. A basic example would be tar
‐czvf myarchive.tar.gz myfiles which creates a new compressed archive file called
"myarchive.tar.gz" that contains all files in a directory called "myfiles".
16.less
the less command in Linux is a pager that allows you to view the contents of a file one page at a
time.
One advantage of using the less command is that it is able to handle large files without
overwhelming the terminal. It only displays a portion of the file at a time, making it easier to
read and navigate through the contents.
Overall, the less command is a useful tool for viewing and navigating the contents of text files in
the terminal. The basic syntax is ‘less [options] filename’. Where filename is the file you want to
view in the terminal and the ‘[options]’ are the additional arguments you can add that can
change display format or setting search parameters.
17.kill
The “kill” command is used in Linux to terminate, pause or perform other actions on a process.
The syntax for this command is ‘kill [options] PID’ where PID refers to the Process ID of the
process you want to terminate or perform other actions on. Running the command ‘kill 12345’
will terminate the process with PID 1234.
18.touch
The touch command in Linux creates a new file with the specified name or updates the
modification time stamp of an existing file.
If the file doesn't exist, the touch command creates an empty file with the specified name. If the
file already exists, the touch command updates the time stamp to the current time.
The touch command is useful when you want to create an empty file, or when you want to
update the time stamp of a file without changing its contents. Figure below shows a basic usage
of a “touch” command.

19.echo
The “echo” command is used to print text or variables on a terminal. When used together with a
string like followed by a file name it can write to the file specified. However it overwrites the file.
Figure below shows the basic usage of the “echo” command.

20.du
This command is used to display the disk usage of files and directories. The basic syntax of
the ‘du’ command is ‘du [OPTIONS] [FILENAMES]’. Here the [OPTIONS] can be used to
specify the display format or filter out certain directories when displaying the results. Some
common [OPTIONS] can be:
‐h: Human‐readable format, display the sizes in a more readable format (e.g. 1K, 1M, 1G).
‐s: Display only a summary of the total disk usage for each directory.
‐c: Display a grand total of the disk usage for all directories.
‐x: Exclude directories on different file systems.
A common usage would be ‘du ‐h’ which can be used to display the disk usage of the current
directory and all its subdirectories in human‐readable format.

How to create a file in Linux?


To create a file in a Linux server, you can use the same steps as creating a file on a local Linux
system. However, there are a few additional steps you may need to follow depending on the
type of server you are using and how you are accessing it. Here are the general steps to create a
file on a Linux server:
Here are the Linux commands after each step to create a file on a Linux server:

1.To connect to the server using SSH, you can use the following command:

Replace “username” with your username and “server address” with the IP address or domain
name of the server you want to connect to.

2.To navigate to the directory where you want to create the file, you can use the cd command:

Replace “directory_name” with the name of the directory you want to navigate to.
3.To create a new file, you can use either the nano or touch command. Here are the commands
for each option:

Replace “filename” with the name you want to give your file.

Using touch:

Replace “filename” with the name you want to give your file.

This step has already been covered in step 3.


4.To type the contents of the file into the editor, you can simply start typing in the editor
window that opens when you run the nano command, or use any other text editor you prefer.
5.To save the file and close the editor, use the instructions specific to the editor you are using.
For example, to save and exit nano, press “Ctrl + X” to exit, then “Y” to save the changes, and
finally “Enter” to confirm the file name.

6.To verify that the file has been created in the directory you specified, you can use the ls
command:

7.This will display a list of all the files and directories in the current directory, including the file
you just created.

That’s it You have successfully created a file on a Linux server.

You might also like