1, Configure SMTP mail service according to the following requiremnets:
-- Your mail server should accept mail from remote hosts and localhost
-- harry must be able to receive mail from remote hosts
-- Mail delivered to mary should spool into the default mail spool for mary /var/spool/mail/mary
install the postfix,
start the postfix and make it auto on when booting,
modify the main.cf
the original inet_interfaces is localhost, if needs to receive the internal and external mails, needs to switch on inet_interfaces = all, and comments off localhost, as following,
harry is local user, so he can receive the external mail, mary should spool into the default mail spool for mary /var/spool/mail/mary, this one also no need to do anything.
Restart the service,
check ports is on now,
check the hostname,
if the hostname is incorrect, needs to modify the /etc/postfix/main.cf, in the line of mydestination add "server3.example.com"
mydestination=.....,server3.example.com
send an email to test the SMTP,
2, Configure an email alias your MTA such that mail sent to harry is received by the local user mary
modify the /etc/aliase
add one line as following, and add harry at the end, mail transferred to mary and harry also can receive mail.
update the database,
newaliases
test the result,
3, Create a shell script /root/program:
--when you input "kernel" parameter to the shell script that will return "user"
--when you input "user" parameter to the shell script that will return "kernel"
--while script no parameter or parameter is wrong,standard error "usage:/root/program kernel|user"
add the source code,
here needs to pay attention to one thing, [ "$1" == "user" ], there are some spaces in the middle, if you missed out the space, the shell program will not work. test the result, ./program user will output kernel, ./program kernel, will output user, if ./program, it will output "usage:/root/program kernel|user."
another way to achieve this is by using the case program,
4, ftp service, allow anonymous to upload file, upload folder path as /var/ftp/upload
lock the local user to home directory, limit certain user to home directory
limit certain user to login to ftp service.
install the vsftp,
start the service and make it auto on,
modify the vsftpd.conf,
uncomment following two lines, save and restart the vsftpd service,
restart the service
create the uploading folder,
change the access right,
change the selinux bool value,
test the result,
ls and !ls to display the folder,
lock the user to home directory,
switch on chroot_local_user
restart the vsftp
test the result,
login as student, and try to go to other folder,
it will return error, "550 failed to change directory"
limit certain user to home directory,
uncomment following two lines,
create file chroot_list,
add sutdent and visitor
limit certain user to login ftp service, modify /etc/vsftpd/ftpusers, to add the users needs to be limited.