linux下发送系统邮件的两种方式

ssh秘钥分发
useradd linuxea

[linuxea@NFS-server ~]$ useradd linuxea
[linuxea@NFS-server ~]$ echo 123|passwd --stdin linuxea

实现本地登录远程免秘钥

[linuxea@NFS-server ~]$ ssh-copy-id -i .ssh/id_dsa.pub linuxea@10.0.0.55

实现本地用户让远程用户免密码登录!

[linuxea@NFS-server ~]$ scp -p .ssh/id_dsa linuxea@10.0.0.53:~/.ssh
[linuxea@NFS-server ~]$ ssh-copy-id -i .ssh/id_dsa.pub linuxea@10.0.0.52

发邮件

[root@NFS-server ~]# /etc/init.d/postfix restart
Shutting down postfix:                                     [  OK  ]
Starting postfix:                                          [  OK  ]
[root@NFS-server ~]# su - linuxea^C
[root@NFS-server ~]# lsof -i :25
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
master  5223 root   12u  IPv4  45229      0t0  TCP localhost:smtp (LISTEN)
master  5223 root   13u  IPv6  45231      0t0  TCP localhost:smtp (LISTEN)
[root@NFS-server ~]# mail -s "linuxea title" 734943463@qq.com </etc/hosts
[root@NFS-server ~]# mailq
Mail queue is empty
[root@NFS-server ~]#

![1.png][1]
if [ -s "/var/log/backupSQLfile.log" ]
    then
    mail -s "$(date +%F-%T) backup" 734943463@qq.com <</var/log/backSQLfail.log
    >/var/log/backSQLfile.log
fi


163:

[root@NFS-server ~]# vim /etc/mail.rc 
#######set mail
set from=usertzc@163.com smtp=smtp.163.com
set smtp-auth-user=usertzc smtp-auth-password=password smtp-auth=login
[root@NFS-server ~]# mail -s linuxea 734943463@qq.com < /etc/rc.local 

2 分享

您可以选择一种方式赞助本站

支付宝扫码赞助

支付宝扫码赞助

日期: 2015-12-28分类: rsync,NFS

标签: ssh

发表评论

已有 2 条评论

加载中,请稍候...
  1. 孙波
    December 29th, 2015 at 11:52 am

    麻烦添加友链。

  2. 绛木子
    绛木子
    December 29th, 2015 at 01:38 pm

    看看