1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | sub Mail_Mailer { my $destination_directory ='/data/'; my $from_address = "abc@gmail.com"; my $to_address = "abc@gmail.com"; my $subject = "SOFT DATA "; my $body = "Dear Sir\nPlease find the complete set of data on sftp\n."; my $cc="test@gmail.com"; opendir (DES,$destination_directory); my @files=readdir(DES); close(DES); my @mail_sent_file=@file; foreach my $mail_file_names (@mail_sent_file) { $body=${body}."\n".$mail_file_names."\n"; } $body=${body}."\nRegards\nreportsadmin."; my $mailer = Mail::Mailer->new("sendmail") or die; $mailer->open( { From => $from_address, To => $to_address, Cc => $cc, Bcc => $bcc, Subject => $subject, } ); print "Going to send the mail."; print $mailer $body; $mailer->close(); print "Mail sent."; return ($mailer); } |
Allowing users to have ssh access Hi Readers, It is one of the tasks we need to complete in order to allow users to log-in into your server without compromising your security. We are going to accomplish the following tasks, 1.) Allow the users for given domain only 2.) Must allow access to a given domain 3.) Block access for a specific domain. These questions are asked in RedHat certification examination RHCE6 We are going to complete the above mention task using iptables To give proper example we are taking 192.168.20.0/255.255.255.0 as our domain and 192.168.21.0/255.255.255.0 as other domain. Assuming that your system is a fresh installation we can remove all rules previously applied. # iptables -F The above mention command will flush all the previously applied rules. Insert a rule in your input chain by below mention command, # iptables -I INPUT -s <ip of your domain>/<subnet mask> -p <protocal tcp/udp> --dport <port> -...
Comments
Post a Comment