導航:首頁 > 編程系統 > linuxweb郵件伺服器

linuxweb郵件伺服器

發布時間:2024-04-07 14:07:18

linux裡面怎樣配置郵件伺服器

Sendmail伺服器配置
首先,在DNS正向解析上添加一個郵件交換器的名稱
這里順便把dns的測回試也答附上:

啟動sendmail

正向主區域配置文件

修改sendmail的配置文件
vi /etc/mail/sendmail.cf

改成

修改sendmail的配置文件
vi /etc/mail/sendmail.mc

去掉dnl

再添加兩行

做輸入重定向m4 /etc/mail/sendmail.mc>/etc/mail/sendmail.cf
編輯 /etc/mail/access

執行makemap hash /etc/mail/access.db </etc/mail/access

編輯vi /etc/mail/local-host-names把郵件伺服器使用的域名給添加上去

重啟sendmail服務

最後給[email protected]發送測試郵件

End。。。

㈡ sendtolinux

濡備綍鍩轟簬Linux鏋惰緒eb寮廠endmail閭浠舵湇鍔″櫒錛

鏂規硶錛氬湪娓歌堝櫒閲岃緭鍏ヨ礬鐢卞櫒鐨勭$悊ip錛屾瘮濡192.168.0.1涓鑸鏄榪欐牱鐨勶紝鎵撳傚笎鍙峰拰瀵嗙爜錛岄夋嫨NAT錛屾垨鑰呯浉搴旂殑絝鍙f槧灝勮彍鍗曘傚湪絝鍙i偅閲岃緭鍏ラ偖浠舵湇鍔″櫒鐨勭鍙25銆傛帴鐫杈撳叆浣犵數鑴戠殑灞鍩熺綉ip

鍦╨inux涓嬶紝濡備綍閰嶇疆sendmail鏈嶅姟鍣錛堟ラわ級錛

sendmail鏄寮婧愰偖浠舵湇鍔″櫒錛岄渶瑕佽嚜宸辨噦鎶鏈錛岄亣鍒伴棶棰樹篃闅捐В鍐熾傚彲浠ヤ嬌鐢╱-mail閭浠剁郴緇熴傚畨瑁呯畝鍗曪紝鏈変笓涓氱殑鎶鏈鏀鎸佸府浣犺В絳旈棶棰樸備嬌鐢ㄥ拰緇存姢涔熷規槗錛屽彲浠ュ厤璐逛笅杞借瘯鐢

linux甯哥敤鍛戒護nastat錛

Netstat鍛戒護鐢ㄤ簬鏄劇ず鍚勭嶇綉緇滅浉鍏充俊鎮錛屽傜綉緇滆繛鎺ワ紝璺鐢辮〃錛屾帴鍙g姸鎬(InterfaceStatistics)錛宮asquerade榪炴帴錛屽氭挱鎴愬憳(MulticastMemberships)絳夌瓑銆

鎵ц宯etstat鍚庯紝鍏惰緭鍑虹粨鏋滀負

$netstat|more

ActiveInternetconnections(w/oservers)

ProtoRecv-QSend-

tcp0010.0.2.15:ssh10.0.2.2:52091ESTABLISHED

ActiveUNIXdomainsockets(w/oservers)

ProtoRefCntFlagsTypeStateI-NodePath

unix11DGRAM11021/dev/log

unix2DGRAM11556@/org/freedesktop/hal/udev_event

unix2DGRAM8986@/org/kernel/udev/udevd

unix3STREAMCONNECTED17777

unix3STREAMCONNECTED17776

鍦╨inux緋葷粺涓鎬庝箞鏍風粰緋葷粺鐢ㄦ埛鍙戦棶鍊欙紵

writeusername緇欐煇涓鐢ㄦ埛鍙戞秷鎮鐢ㄥ懡浠wall緇欐墍鏈夌敤鎴峰彂娑堟伅銆傜浉褰撲簬writeallwall--sendamessagetoeverybody鈥檚terminal

linux鏈嶅姟涔嫿penSSH鏈嶅姟錛

OpenSSH榪欎竴鏈璇鎸囩郴緇熶腑浣跨敤鐨凷ecureShell杞浠剁殑杞浠跺疄鏂姐傜敤浜庡湪榪滅▼緋葷粺涓婂畨鍏ㄨ繍琛宻hell銆傚傛灉鎮ㄥ湪鍙鎻愪緵ssh鏈嶅姟鐨勮繙紼婰inux緋葷粺涓鎷ユ湁鐢ㄦ埛甯愭埛錛屽垯ssh鏄閫氬父鐢ㄦ潵榪滅▼鐧誨綍鍒拌ョ郴緇熺殑鍛戒護銆俿sh鍛戒護涔熷彲鐢ㄤ簬鍦ㄨ繙紼嬬郴緇熶腑榪愯屽懡浠ゃ

甯歌佺殑榪滅▼鐧誨綍宸ュ叿鏈夛細

telnet

ssh

dropbear

telnet//榪滅▼鐧誨綍鍗忚錛23/TCP//涓鑸鐢ㄤ簬嫻嬭瘯絝鍙f垨鑰呮帴鍙f槸鍚﹀紑鍚

璁よ瘉鏄庢枃

鏁版嵁浼犺緭鏄庢枃

ssh//SecureSHell錛屽簲鐢ㄥ眰鍗忚錛22/TCP

閫氫俊榪囩▼鍙婅よ瘉榪囩▼鏄鍔犲瘑鐨勶紝涓繪満璁よ瘉

鐢ㄦ埛璁よ瘉榪囩▼鍔犲瘑

鏁版嵁浼犺緭榪囩▼鍔犲瘑

dropbear//宓屽叆寮忕郴緇熶笓鐢ㄧ殑SSH鏈嶅姟鍣ㄧ鍜屽㈡埛絝宸ュ叿錛屼竴鑸搴旂敤浜庢墜鏈轟笂

1.2SSH鐗堟湰

openssh鏈変袱涓鐗堟湰錛屽垎鍒涓簐1鍜寁2錛屽叾鐗圭偣濡備笅錛

v1錛氬熀浜嶤RC-32鍋歁AC錛屾棤娉曢槻鑼冧腑闂翠漢鏀誨嚮

v2錛氬弻鏂逛富鏈哄崗璁閫夋嫨瀹夊叏鐨凪AC鏂瑰紡銆傚熀浜嶥H綆楁硶鍋氬瘑閽ヤ氦鎹錛屽熀浜嶳SA鎴朌SA綆楁硶瀹炵幇韜浠借よ瘉

鍏充簬瀵嗛掗浜ゆ崲

鍗忓晢鐢熸垚瀵嗙爜鐨勮繃紼嬪彨鍋氬瘑閽ヤ氦鎹錛圛nternetKeyExchange錛孖KE錛変嬌鐢ㄧ殑鏄疍H鍗忚錛圖iffie-Hellman錛夛細

A(涓繪満)-->B錛堜富鏈猴級

p,g錛堝ぇ緔犳暟錛岀敓鎴愭暟錛夛紝鍦ㄧ綉緇滀腑浼犺緭鐨勶紝鍏寮鐨

A錛氳嚜宸卞彇涓涓闅忔満鏁皒

B錛氳嚜宸卞彇涓涓闅忔満鏁皔

A錛歡^x%p-->B

B錛歡^y%p-->A

A錛(g^y%p)^x=g^yx%p

B錛(g^x%p)^y=g^xy%p

榪欐渶鍚庡緱鍑虹殑g^xy%p灝辨槸鏈緇堢殑瀵嗛掗

1.3SSH璁よ瘉鏂瑰紡

openssh鏈変袱縐嶈よ瘉鏂瑰紡錛屽垎鍒鏄錛

鍩轟簬鍙d護璁よ瘉錛堝嵆瀵嗙爜璁よ瘉錛

鍩轟簬瀵嗛掗璁よ瘉錛堥潪瀵圭О鍔犲瘑銆傛湁涓瀵瑰瘑閽ワ紝鍏閽ワ紙P錛夊拰縐侀掗錛圫錛夛級

1.4openSSH鐨勫伐浣滄ā寮

openSSH鏄鍩轟簬C/S鏋舵瀯宸ヤ綔鐨

鏈嶅姟鍣ㄧ//sshd錛岄厤緗鏂囦歡鍦/etc/ssh/sshd_config

#vim/etc/ssh/sshd_config

#$OpenBSD:sshd_config,v1.1002016/08/1512:32:04naddyExp$

#Thisisthesshdserversystem-wideconfigurationfile.See

#sshd_config(5)formoreinformation.

#ThissshdwascompiledwithPATH=/usr/local/bin:/usr/bin

#_configshippedwith

#

#possible,butleavethemcommented.Uncommentedoptionsoverridethe

#defaultvalue.

#,youhavetotell

#SELinuxaboutthischange.

#semanageport-a-tssh_port_t-ptcp#PORTNUMBER

#

#Port22

#AddressFamilyany

#ListenAddress0.0.0.0

#ListenAddress::

.

.

.

#-userbasis

#MatchUseranoncvs

#X11Forwardingno

#AllowTcpForwardingno

#PermitTTYno

#ForceCommandcvsserver

瀹㈡埛絝

//ssh錛岄厤緗鏂囦歡鍦/etc/ssh/ssh_config

ssh-keygen//瀵嗛掗鐢熸垚鍣

ssh--id//灝嗗叕閽ヤ紶杈撹嚦榪滅▼鏈嶅姟鍣

scp//璺ㄤ富鏈哄畨鍏ㄥ嶅埗宸ュ叿

$OpenBSD:ssh_config,v1.302016/02/2023:06:23sobradoExp$

#Thisisthesshclientsystem-wideconfigurationfile.See

#ssh_config(5)formoreinformation.Thisfileprovidesdefaultsfor

#users,andthevaluescanbechangedinper-userconfigurationfiles

#oronthecommandline.

#:

#1.commandlineoptions

#2.user-specificfile

#3.system-widefile

#.

#Thus,host-

#configurationfile,anddefaultsattheend.

#Site-.Foracomprehensive

#listofavailableoptions,theirmeaningsanddefaults,pleaseseethe

#ssh_config(5)manpage.

#Host*

#ForwardAgentno

#ForwardX11no

#RhostsRSAAuthenticationno

#RSAAuthenticationyes

#PasswordAuthenticationyes

.

.

.

#Sendlocale-relatedenvironmentvariables

SendEnvLANGLC_CTYPELC_NUMERICLC_TIMELC_COLLATELC_MONETARYLC_MESSAGES

SendEnvLC_PAPERLC_NAMELC_ADDRESSLC_TELEPHONELC_MEASUREMENT

SendEnvLC_IDENTIFICATIONLC_ALLLANGUAGE

SendEnvXMODIFIERS

1.5SecureShell紺轟緥

//浠ュ綋鍓嶇敤鎴瘋韓浠藉壋寤鴻繙紼嬩氦浜掑紡shell錛岀劧鍚庡湪緇撴潫鏃朵嬌鐢╡xit鍛戒護榪斿洖鍒頒箣鍓嶇殑shell

#ssh192.168.112.131

Theauthenticityofhost餘.168.112.131(192.168.112.131)'can'tbeestablished.

//鐢熸垚浜嗕竴涓綆楁硶鏄瘲HA256寰楀叕閽

ECDSAkeyfingerprintisSHA256:dyCibeKTgTQDtKrGgYAKVnGsLcR/Necufp4Jvnx0cTc.

ECDSAkeyfingerprintisMD5:bb:a6:d4:16:be:40:d1:d9:ef:6b:89:c9:22:bb:bd:b0.

//闂浣犳槸鍚︿俊浠繪墍榪炴帴寰椾富鏈猴紝涓嶄俊浠誨垯涓嶈繛鎺

(yes/no)?yes

Warning:Permanentlyadded餘.168.112.131'(ECDSA)tothelistofknownhosts.

[email protected]'spassword:

Lastlogin:MonApr114:24:132019from192.168.112.14

//姝ゆ椂浠庣敤鎴峰悕寰楃煡宸茬粡鐧婚檰鍒板彟涓鍙頒富鏈

#

//浠ュ叾浠栫敤鎴瘋韓浠斤紙remoteuser錛夊湪閫夊畾涓繪満錛坮emotehost錛変笂榪炴帴鍒拌繙紼媊shell`

#[email protected]

[email protected]'spassword:

Lastlogin:MonApr114:24:542019from192.168.112.14

#

//浠ヨ繙紼嬬敤鎴瘋韓浠斤紙remoteuser錛夊湪榪滅▼涓繪満錛坮emotehost錛変笂閫氳繃灝嗚緭鍑鴻繑鍥炲埌鏈鍦版樉紺哄櫒鐨勬柟寮忔潵鎵ц屽崟涓鍛戒護

//棣栧厛鐧婚檰涓鍙頒富鏈烘煡鐪嬭嚜宸盜P

#ipasens33

2:ens33:BROADCAST,MULTICAST,UP,LOWER_UP>mtu1500qdiscpfifo_faststateUPqlen1000link/ether00:0c:29:8e:77:9bbrdff:ff:ff:ff:ff:ffinet192.168.112.131/24brd192.168.112._lft1191secpreferred_lft1191secinet6fe80::bc68:f1a3:4a1f:87fb/64scopelink

valid_lftforeverpreferred_lftforever

//鍦ㄧ敤鍙︿竴鍙頒富鏈洪氳繃ssh鏉ヨ繙紼嬫墽琛屽懡浠

#[email protected]'/usr/sbin/ipasens33'

[email protected]'spassword:

2:ens33:BROADCAST,MULTICAST,UP,LOWER_UP>mtu1500qdiscpfifo_faststateUPqlen1000link/ether00:0c:29:8e:77:9bbrdff:ff:ff:ff:ff:ffinet192.168.112.131/24brd192.168.112._lft1783secpreferred_lft1783secinet6fe80::bc68:f1a3:4a1f:87fb/64scopelink

valid_lftforeverpreferred_lftforever

#

//w鍛戒護鍙浠ユ樉紺哄綋鍓嶇櫥褰曞埌璁$畻鏈虹殑鐢ㄦ埛鍒楄〃銆傝繖瀵逛簬鏄劇ず鍝浜涚敤鎴蜂嬌鐢╯sh浠庡摢浜涜繙紼嬩綅緗榪涜屼簡鐧誨綍浠ュ強鎵ц屼簡浣曠嶆搷浣滅瓑鍐呭圭壒鍒鏈夌敤

#ssh192.168.112.131

[email protected]'spassword:

Lastlogin:MonApr114:30:572019from192.168.112.14

//鍦ㄥ垏鎹㈠埌GUI涓繪満浣跨敤w鍛戒護鏌ョ湅鍙浠ョ湅鍒192.168.112.14鐢ㄦ埛鍦ㄧ櫥闄嗕腑

#w14:40:59up4:37,2users,loadaverage:0.00,0.02,0.05

USERTTYFROMLOGIN@IDLEJCPUPCPUWHAT

rootpts/0192.168.112.110:033.00s0.17s0.01sw

rootpts/1192.168.112.1414:402.00s0.03s0.03s-bash

1.5SSH涓繪満瀵嗛掗

ssh閫氳繃鍏閽ュ姞瀵嗙殑鏂瑰紡淇濇寔閫氫俊瀹夊叏銆傚綋鏌愪竴ssh瀹㈡埛絝榪炴帴鍒皊sh鏈嶅姟鍣ㄦ椂錛屽湪璇ュ㈡埛絝鐧誨綍涔嬪墠錛屾湇鍔″櫒浼氬悜鍏跺彂閫佸叕閽ュ壇鏈銆傝繖鍙鐢ㄤ簬涓洪氫俊娓犻亾璁劇疆瀹夊叏鍔犲瘑錛屽苟鍙楠岃瘉瀹㈡埛絝鐨勬湇鍔″櫒銆

褰撶敤鎴風涓嬈′嬌鐢╯sh榪炴帴鍒扮壒瀹氭湇鍔″櫒鏃訛紝ssh鍛戒護鍙鍦ㄧ敤鎴風殑/.ssh/known_hosts鏂囦歡涓瀛樺偍璇ユ湇鍔″櫒鐨勫叕閽ャ傚湪姝や箣鍚庢瘡褰撶敤鎴瘋繘琛岃繛鎺ユ椂錛屽㈡埛絝閮戒細閫氳繃瀵規瘮/.ssh/known_hosts鏂囦歡涓鐨勬湇鍔″櫒鏉$洰鍜屾湇鍔″櫒鍙戦佺殑鍏閽ワ紝紜淇濅粠鏈嶅姟鍣ㄨ幏寰楃浉鍚岀殑鍏閽ャ傚傛灉鍏閽ヤ笉鍖歸厤錛屽㈡埛絝浼氬亣瀹氱綉緇滈氫俊宸查伃鍔鎸佹垨鏈嶅姟鍣ㄥ凡琚鍏ヤ鏡錛屽苟涓斾腑鏂榪炴帴銆

榪欐剰鍛崇潃錛屽傛灉鏈嶅姟鍣ㄧ殑鍏閽ュ彂鐢熸洿鏀癸紙鐢變簬紜鐩樺嚭鐜版晠闅滃艱嚧鍏閽ヤ涪澶憋紝鎴栬呭嚭浜庢煇浜涙e綋鐞嗙敱鏇挎崲鍏閽ワ級錛岀敤鎴峰垯闇瑕佹洿鏂板叾~/.ssh/known_hosts鏂囦歡騫跺垹闄ゆ棫鐨勬潯鐩鎵嶈兘澶熻繘琛岀櫥褰曘

//涓繪満ID瀛樺偍鍦ㄦ湰鍦板㈡埛絝緋葷粺涓婄殑~/.ssh/known_hosts涓(瀹剁洰褰曚腑鐨勯殣鈃忕洰褰.ssh)

#cat/root/.ssh/known_hosts

192.168.112.131ecdsa-sha2-ayz0bbvSc5be4/rddT4r2q//eg1Z11x05bGjRJfL+8=

//涓繪満瀵嗛掗瀛樺偍鍦⊿SH鏈嶅姟鍣ㄤ笂鐨/etc/ssh/ssh_host_key*涓錛堜篃灝辨槸涓嶆墜鍔ㄧ敓鎴愬瘑閽ョ殑鎯呭喌涓嬩細鑷鍔ㄤ嬌鐢ㄨ繖閲岀殑瀵嗛掗錛

#ls/etc/ssh/*key*

/etc/ssh/ssh_host_ecdsa_key/etc/ssh/ssh_host_ecdsa_key.pub/etc/ssh/ssh_host_ed25519_key/etc/ssh/ssh_host_ed25519_key.pub/etc/ssh/ssh_host_rsa_key/etc/ssh/ssh_host_rsa_key.pub

2.閰嶇疆鍩轟簬SSH瀵嗛掗鐨勮韓浠介獙璇

鐢ㄦ埛鍙閫氳繃浣跨敤鍏閽ヨ韓浠介獙璇佽繘琛宻sh鐧誨綍韜浠介獙璇併俿sh鍏佽哥敤鎴蜂嬌鐢ㄧ侀掗-鍏閽ユ柟妗堣繘琛岃韓浠介獙璇併傝繖鎰忓懗鐫灝嗙敓鎴愮侀掗鍜屽叕閽ヨ繖涓や釜瀵嗛掗銆傜侀掗鏂囦歡鐢ㄤ綔韜浠介獙璇佸嚟鎹錛屽儚瀵嗙爜涓鏍鳳紝蹇呴』濡ュ杽淇濈°傚叕閽ュ嶅埗鍒扮敤鎴峰笇鏈涚櫥褰曠殑緋葷粺錛岀敤浜庨獙璇佺侀掗銆傚叕閽ュ苟涓嶉渶瑕佷繚瀵嗐傛嫢鏈夊叕閽ョ殑ssh鏈嶅姟鍣ㄥ彲浠ュ彂甯冧粎鎸佹湁鎮ㄧ侀掗鐨勭郴緇熸墠鍙瑙g瓟鐨勯棶棰樸傚洜姝わ紝鍙浠ユ牴鎹鎵鎸佹湁鐨勫瘑閽ヨ繘琛岄獙璇併傚傛や竴鏉ワ紝灝變笉蹇呭湪姣忔¤塊棶緋葷粺鏃墮敭鍏ュ瘑鐮侊紝浣嗗畨鍏ㄦт粛鑳藉緱鍒頒繚璇併

浣跨敤ssh-keygen鍛戒護鐢熸垚瀵嗙爜銆傚皢浼氱敓鎴愮侀掗/.ssh/id_rsa鍜屽叕閽/.ssh/id_rsa.pub銆

//浣跨敤ssh-keygen鐢熸垚瀵嗛掗鏃墮栧厛浼氳㈤棶浣犲瘑閽ユ枃浠跺瓨鏀劇殑浣嶇疆錛岄粯璁ゆ槸鍦/root/.ssh/id_rsa鍜宨d_rsa.pub

#ssh-keygen

Generatingpublic/privatersakeypair.

Enterfileinwhichtosavethekey(/root/.ssh/id_rsa):

//鎺ョ潃浼氳㈤棶浣犳槸鍚︿負浣犵殑縐侀掗閰嶇疆瀵嗙爜

Enterpassphrase(emptyfornopassphrase):

//鏈鍚庝細鎻愮ず浣犲瘑閽ュ壋寤烘垚鍔燂紝縐侀掗瀛樻斁鍦╥d_rsa,鍏閽ユ斁鍦╥d_rsa.pub

/root/.ssh/id_rsa.

Yourpublickeyhasbeensavedin/root/.ssh/id_rsa.pub.

Thekeyfingerprintis:

SHA256:XFV5J+RPAuuHQZBipB8yUyQ22/QAOWT+z2Tsi+cJcpwroot@CTL

Thekey'srandomartimageis:

//RSA綆楁硶瀵嗛掗涓鑸涓2048浣

+-------+

|.B=*.o+oo.|

|+oOoo.o+oo|

|Boo.ooooo|

|B+.o+|

|S+o..|

|.B.|

|.E+|

|oo.o|

|.o+|

+---------+

娉ㄦ剰錛

鐢熸垚瀵嗛掗鏃訛紝緋葷粺灝嗘彁渚涙寚瀹氬瘑鐮佺殑閫夐」錛屽湪璁塊棶縐侀掗鏃跺繀欏繪彁渚涜ュ瘑鐮併傚傛灉縐侀掗琚鍋鳳紝闄ら佸彂鑰呬箣澶栫殑鍏朵粬浠諱綍浜哄緢闅句嬌鐢ㄨョ侀掗錛屽洜涓哄凡浣跨敤瀵嗙爜瀵瑰叾榪涜屼繚鎶ゃ傝繖鏍鳳紝鍦ㄦ敾鍑昏呯牬瑙e苟浣跨敤縐侀掗鍓嶏紝浼氭湁瓚沖熺殑鏃墮棿鐢熸垚鏂扮殑瀵嗛掗瀵瑰苟鍒犻櫎鎵鏈夋秹鍙婃棫瀵嗛掗鐨勫唴瀹廣

閱讀全文

與linuxweb郵件伺服器相關的資料

熱點內容
怎麼樣讓自己的網站不被別人看到 瀏覽:711
編程擴展效果如何 瀏覽:335
榮耀暢玩手環同步qq 瀏覽:475
怎麼向sql中添加資料庫 瀏覽:596
錄歌失敗重啟app什麼意思 瀏覽:522
壓縮文件包怎麼在微信發送 瀏覽:432
mysql資料庫怎麼插入時間值 瀏覽:191
微信視頻不能轉發朋友圈 瀏覽:596
影視後期的app有哪些 瀏覽:956
電子保單數據出錯什麼意思 瀏覽:368
如何以文件下載音樂 瀏覽:438
計算機網路章節練習 瀏覽:999
單片機的外部中斷程序 瀏覽:48
表格批量更名找不到指定文件 瀏覽:869
js的elseif 瀏覽:584
3dmaxvray視頻教程 瀏覽:905
imgtool工具中文版 瀏覽:539
java幫助文件在哪裡 瀏覽:965
win10切換輸入語言 瀏覽:696
haier電視網路用不了怎麼辦 瀏覽:361

友情鏈接