Showing posts with label Server. Show all posts
Showing posts with label Server. Show all posts

Apache web server


Apache Web Server: Introduction and Installation


What is Apache web Server?

Apache is a most popular, freely available open source web server. A Web server accepts HTTP requests from web clients and serves them HTTP responses in the form of web pages that contains static (text, images etc) and dynamic (scripts) content.

According to the Apache Software Foundation:

The name 'Apache' was chosen from respect for the Native American Indian tribe of Apache, well-known for their superior skills in warfare strategy and their inexhaustible endurance. It also makes a cute pun on "a patchy web server" -- a server made from a series of patches -- but this was not its origin. The group of developers who released this new software soon started to call themselves the "Apache Group".

Samba Server Access Control Options


Options to restrict the security in Samba Server



valid users

It is required when some users only can access the directory, not all users.


[sales]
path = /home/samba/sales
comment = Sales Data
writeable = yes
valid users = tom dick harry


Here sales directory can be accessed by the user listed in valid users.

invalid users

To explicitly deny the listed users access we use invalid users. If the user is present in both list then user can’t access the directory.

[sales]
path = /home/samba/sales
comment = Sales Data
writeable = yes
valid users = tom dick harry
invalid users = kim

Samba User Security

Samba User authentication and security


If we want only valid user can only access the Samba server then we use security as user in global section. If we set security = user in global section then user will require to provide password to access the Samba Server.


The global for user security

[global]
workgroup = WORKGROUP
server string = Samba Server
netbios name = LinuxSamba
security = user


Creating Samba User


Samba User Creation on Samba Server


We can create a user for Samba Server who can own files and directories.

First we create a Linux user who can’t login to any shell.


# useradd -s /bin/false sambauser
# passwd password
Changing password for user sambauser.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.


Now we create a samba share directory for the user with owner permissions.

# mkdir /home/samba/sambauserdir
# chown -R sambauser:sambauser /home/samba/sambauserdir


Sharing a directory with Samba



Sharing Files and Directories with Samba


Update the global section of configuration file smb.conf as below

[global]

workgroup = WORKGROUP

server string = Samba Server

netbios name = LinuxSamba

security = share


Enter the name of workgroup, put server string name as you wish, write the netbios name and security as share.

Samba Server Configuration in Linux

Configuring Samba Server


To install Samba run command

yum install samba samba-client samba-common

The Samba Configuration file is /etc/samba/smb.conf

Take a backup of this file before configuring any samba share using command
mv /etc/samba/smb.conf /etc/samba/smb.conf.bkp


Minimal smb.conf


Here is an example of a minimum configuration of smb.conf

$ cat /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
[firstshare]
path = /srv/samba/public

Daemons required for Samba Server

Samba daemons


Samba consists mainly three daemons nmbd, smbd and winbindd and one management service application SWAT.

nmbd


The nmbd daemon takes care of all the names and naming. This daemon listens for name-server requests and provides the appropriate IP addresses when called upon. It registers and resolves names, and handles browsing. According to the Samba documentation, it should be the first daemon to start.

Samba Server - Introduction and Installation



What is Samba?


Samba is an Open Source and Free Software suite that provides seamless file and print services to SMB/CIFS clients." Samba is freely available and used to communicate with Linux/Unix servers and Windows-based clients.

Samba implements the CIFS network protocol. Samba offers many services. It can share one or more directory tree. It also provides Windows Internet Name Service (WINS) name-server resolution and Distributed Filesystem (MS-DFS) namespace. It manages printers, print settings, and their associated drivers for access from Windows clients.

Configuring NFS on Linux


Installing NFS Server and NFS Client


We need to install NFS packages (nfs-utils and nfs-utils-lib ) which contains all required NFS services  on our NFS Server as well as on NFS Client machine. We can install it via “yum” (Red Hat Linux) and “apt-get” (Debian and Ubuntu) package installers.

[root@nfsserver ~]# yum install nfs-utils nfs-utils-lib

[root@nfsserver ~]# yum install portmap (not required with NFSv4)

Start the services on both machines and enable auto start at boot time.

[root@nfsserver ~]# /etc/init.d/portmap start

[root@nfsserver ~]# /etc/init.d/nfs start

[root@nfsserver ~]# chkconfig --level 35 portmap on

[root@nfsserver ~]# chkconfig --level 35 nfs on


Network File System (NFS) Services

NFS Services


All NFS versions rely on Remote Procedure Calls (RPC) between clients and servers. RPC services under Red Hat Enterprise Linux 6 are controlled by the rpcbind service. To share or mount NFS file systems, the following services work together.



rpcbind

(portmap in older versions of Linux) The primary daemon upon which all the others rely, rpcbind manages connections for applications that use the RPC specification. By default, rpcbind listens to TCP port 111 on which an initial connection is made. This is then used to negotiate a range of TCP ports, usually above port 1024, to be used for subsequent data transfers. You need to run rpcbind on both the NFS server and client. This is not used with NFSv4.

NFS Server - Configuration Files

Configuration Files of NFS Server in Linux


Main configuration files to set up an NFS server is /etc/exports.

Other two file required to restrict IP address are /etc/hosts.allow, and /etc/hosts.deny.


/etc/exports


This file contains a list of directory that is shared and its options.

An entry in /etc/exports is like

/nfsdir 192.168.1.101(rw,sync,no_root_squash) 192.168.1.102(ro,sync)

Here /nfsdir is directory that you want to share. If you share a directory, then all directories under it within the same file system will be shared as well.

NFS Server in Linux - Concepts


NFS (Network File System)


NFS stands for Network File System, a file system developed by Sun Microsystems, Inc. A Network File System (NFS) allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. For example, if you were using a computer linked to a second computer via NFS, you could access files on the second computer as if they resided in a directory on the first computer.

NFS is used for sharing of files and folders between Linux/UNIX like systems. It allows user to mount their local file systems over a network and remote hosts to interact with them as they are mounted locally on the same system. With the help of NFS, we can set up file sharing between UNIX and Linux systems.

Telnet Server Configuration and Commands in Linux

Telnet


Telnet protocol allows you to connect to remote hosts over TCP/IP network (such as the Internet). Using telnet client software on your computer, you can make a connection to a telnet server (i.e., the remote host). Once your telnet client establishes a connection to the remote host, your client becomes a virtual terminal, allowing you to communicate with the remote host from your computer. In most cases, you'll need to log into the remote host, which requires that you have an account on that system or public without having an account.

Telnet by default does not encrypt any data sent over the connection.

FTP Linux Commands

Linux Commands of FTP Server



Command to connect ftp server

ftp ftp.example.com

ftp 192.268.10.20

ftp user@ftp.example.com


This command will attempt to connect to the ftp server. If it succeeds, it will ask to log in using a username and password. Public ftp servers often allow you to log in using the username "anonymous".

FTP Server Configuration


Configuration of VSFTPD


Vsftpd configuration file can be found on /etc/vsftpd/vsftpd.conf. After making any change in the file you need to restart the vsftpd service.

Default setting

By default ftp is set for anonymous login, and only permits download not upload.

Anonymous user cannot create directory in default setting.

By default VSFTPD uses directory /var/ftp

Default log file location is /var/log/vsftpd.log


FTP Server Installation Steps in Linux



What is VSFTPD?


FTP by itself is not a very secure. Data transmitted in clear text, without encryption so making it subject to interception and theft. Now we have more secure options the Very Secure FTP daemon (vsftpd)

VSFTPD features

  • Virtual IP configurations
  • Powerful per-user configurability
  • Band Width limits
  • Per-source-IP configurability
  • Per-source-IP limits
  • IPv6 compatible
  • Encryption support through SSL integration
  • Very high security requirements
  • Good scalability
  • Virtual users can be created
  • Better than average performance
  • High speed


FTP server Basics and Types


What is FTP


FTP stands for File Transfer Protocol and it is used as one of the most common means of copying files between server and client over a TCP based network like Internet. FTP is the most used protocol over internet to transfer files.

Any Linux system can operate as an FTP server. It has to run only the server software—an FTP daemon with the appropriate configuration. Transfers are made between user accounts on client and server systems.


FTP Ports


FTP uses TCP ports for communication between client and server. It uses two ports Control and Data

FTP Control Channel, TCP Port 21: This port is used for commands that we send and then get back the response from ftp server. It is called control channel and uses port 21.

FTP Data Channel, TCP Port 20: This port is used for the data transfers between the client and server.