Today I’m going to tell you the basic configuration steps of some of the servers used in Linux like FTP, HTTP and SQUID. These configurations are important in the prospective of your RHCE exam also. Hope these Posts will be informative and help you to crack your RHCE exam.
FTP (File Transfer Protocol) Configuration:
The objectives of FTP are:
1) To promote sharing of files (computer programs and/or data),
2) To encourage indirect or implicit (via programs) use of remote computers,
3) To shield a user from variations in file storage systems among hosts, and
4) To transfer data reliably and efficiently.
FTP, though usable directly by a user at a terminal, is designed mainly for use by programs.
Figure showing FTP Schema
Figure showing the transfer of files from a FTP Server to a FTP Client.
# VSFTPD Configuration.
NOTE : In my case 192.168.8.1 is ftp server i have Jack and Jill with password as password in server. 192.168.8.2 and 192.168.8.3 is acting as ftp client to ftp server 192.168.8.1.
Task 1: To Allow ftp user to download files
IN 192.168.8.1:
--------------
Step 1: install vsftpd package
# yum install vsftpd
Step 2: keep the required files in /var/ftp
# touch /var/ftp/f{1..5}
Step 3: start vsftpd service.
# service vsftpd restart
Step 4: make the service persistent across the reboot.
# chkconfig vsftpd on
IN 192.168.8.2:
--------------
Step 1: check whether ftp user is allowed to download files or not.
# ftp 192.168.8.1
ftp> get f1
ftp> bye
Task 2: To Allow ftp user to upload files
IN 192.168.8.1:
---------------
Step 1: create a directory may be /var/ftp/upload which is writeable by ftp user.
# mkdir /var/ftp/upload
# chgrp ftp /var/ftp/upload
# chmod g+w /var/ftp/upload
Step 2: Allow anonymous user to upload the files in configuration file.
line 27 looks like:
#anon_upload_enable=YES
it should be uncommented and now it should look like:
anon_upload_enable=YES
Step 3: restart vsftpd service.
# service vsftpd restart
Step 4: make changes in SELinux policy to allow anonymous user to upload files
# setsebool -P allow_ftpd_anon_write=1
Step 5: change context of directory to allow anonymous user to upload files
# chcon -t public_content_rw_t /var/ftp/upload
IN 192.168.8.2:
--------------
Step 1: create the file which you want to upload.
# touch /root/client1
Step 2: check whether ftp user is allowed to upload files or not.
# ftp 192.168.8.1
ftp> cd upload
ftp> put /root/client1
ftp> by
Task 3: To Allow normal user Jack with password as password to download and upload files.
IN 192.168.8.1:
----------------
Step 1: Create user Jack with password as password
# useradd Jack
# echo "password" | passwd --stdin Jack
( NOTE: Use the above mentioned technique to assign password for the user instead of the traditional method "passwd <username>", coz here there is no need to type the password 2 times so it saves some time in RHCE exam and you can also know what password you are providing so it reduces the probability of assigning a wrong password to the user).
Step 2: keep some files in Jack user’s home directory.
# touch /home/Jack/b{1..5}
Step 3: change SElinux policy so that normal users can get access to their home directories.
# setsebool -P ftp_home_dir=1
IN 192.168.8.2:
--------------
Step 1: create the file which you want to upload.
# touch /root/client2
Step 2: check whether Jack user is allowed to upload files or not.
# ftp 192.168.8.1 -u Jack
Password:
ftp> get b1
ftp> put /root/client2
ftp> bye
In case of any problem or queries or suggestions feel free to leave a comment here..:)