<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="http://120.112.17.17/blog/styles/rss.css" type="text/css"?>
<rss version="0.91">

 <channel>
  <title>豬窩</title>
  <link>http://120.112.17.17/blog/shyong</link>
  <description> 小豬的備忘錄,對錯完全不負責 
</description>
    <item>
   <title>linux 臨時增加一組虛擬網卡IP</title>
   <description> 
有時需要在 Linux 臨時增加一組 IP , 又不想增加網卡,只好增加一組虛擬網卡IP,用完記得 down 
 
 
假設原網卡名稱 eth0 , 虛擬網卡加 :0　即可
 
 
	 增加 :&nbsp; ifconfig eth0:0 10.0.0.1 up 
	 取消 :&nbsp; ifconfig eth0:0 10.0.0.1 down 
 
 
 </description>
   <link>http://120.112.17.17/blog/shyong/archives/588</link>
      <pubDate>Sun, 08 Sep 2019 10:14:29 +0800</pubDate>   
  </item>
    <item>
   <title>centos 7 安裝記錄</title>
   <description> 
	 service 改成 systemctl
	 
		 systemctl 列出所有 service 
		 systemctl status servie 列出 service 狀況 
		 systemctl stop service 停止 
		 systemctl start service 啟動 
		 systemctl enable service 開機啟動 
		 systemctl disable service 取消啟 
	 
	 
	 檔案系統 ext4 改成 xfs
	 
		  lsblk -f 或 blkid 先找到磁碟，再用 parted /dev/xxx print 來找出內部的分割表類型，之後才用 gdisk 或 fdisk 來操作系統, mkfs.xfs 或 mkfs.ext4 格式化 
		 quota 設定改成 xfs_quota ,  xfs_quota 不能設定在 / 根目錄   
		 /usr/sbin/xfs_quota -x -c &quot;limit bsoft=1000M bhard=1024M phpinii&quot; /mnt2 
		xfs_quota -x -c &quot;print&quot; 
		xfs_quota -x -c &quot;report -b&quot; /home 
	 
	 
	 apache 2.4 設定必須加入 Require all granted 才能使用該目錄,否則會有 authz_core:error , client denied by server configuration: 在 error_log 中顯示
	 
		 &lt;Directory &quot;/home/ * / * /www&quot;&gt; 
		&nbsp;&nbsp;&nbsp; AllowOverride FileInfo AuthConfig Limit Indexes 
		&nbsp;&nbsp;&nbsp; Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec 
		&nbsp;&nbsp;&nbsp; Require method GET POST OPTIONS 
		&nbsp;&nbsp;&nbsp; Require all granted 
		&lt;/Directory&gt; 
		在個人目錄的&nbsp; userdir.conf 中個人目錄絕對路徑要正確,用 * 表示所有目錄 , 如果有二層,就必須有二個 * ,例如 /home/ office / piggy /www 
	 
	 
	 在 samba 用 nmb 時無法啟用,原來是 smb.conf 中&nbsp; interfaces = lo eno1 網卡介面名稱要對,內定是 eth0 要記得改  
	 在用 freeradius 有檔案屬性錯誤,原來是 /usr/lib/systemd/system/radiusd.service 所有檔案只能 644 
	 若有用 firewall 指令
	 
		 firewall-cmd --zone=public --add-port=995/tcp --permanent 
		firewall-cmd --reload 
		firewall-cmd --list-all 
		其實我覺得直接改 /etc/firewalld/zones/public.xml 再 firewall-cmd --reload 比較簡 
	 
	 
	 在 dovecot 的 conf.d/10-mail.conf 多了一個 first_valid_uid = 500 內定是 1000 ,也就是 uid 要大於等於 500 的 user ,才可以使用 imap 或 pop3 的功能,否則會在 /var/log/maillog 產生&nbsp; not permitted (see first_valid_uid in config file)的訊息 
	 pop3收信,沒有 ssl失敗,將 conf.d/10-ssl.conf 下的 ssl = required 改成 ssl = yes 
	 變身使用者:先轉成 root 身份,再用 su -l 使用者 , 就不須要使用者密碼了 
 </description>
   <link>http://120.112.17.17/blog/shyong/archives/562</link>
      <pubDate>Sat, 13 May 2017 20:44:48 +0800</pubDate>   
  </item>
    <item>
   <title>mail文件主旨編碼</title>
   <description> 
mail 主旨的編碼方式好像大部份是 base64,如果你看到的是  
MIME格式：  =?國家碼代號？編碼方式？內容.....?=  
國家碼代號=&gt;英文：US-900A，中文(Big5內碼)：big5  
編碼方式===&gt;Q：Quoted-Printable，B：Base-64 
Subject: =?big5?B?UmU6IKZVpuyl66bxLKdAt36o06RGLi4u?=  
這一段就是base64編碼  UmU6IKZVpuyl66bxLKdAt36o06RGLi4u  
如果用 php 就用 base64_decode($str) 解碼就可以了,記得是 big5或utf-8,網頁編碼格式要對
 </description>
   <link>http://120.112.17.17/blog/shyong/archives/549</link>
      <pubDate>Fri, 29 Jul 2016 08:58:46 +0800</pubDate>   
  </item>
    <item>
   <title>Liunx LVM 備忘</title>
   <description>Physical Volume, PV, 實體捲軸
 
Volume Group, VG, 捲軸群組
 
Physical Extent, PE, 實體範圍區塊
 
Logical Volume, LV, 邏輯捲軸
 
參考: http://linux.vbird.org/linux_basic/0420quota.php#lvm_whatis
 </description>
   <link>http://120.112.17.17/blog/shyong/archives/544</link>
      <pubDate>Sun, 01 May 2016 11:21:37 +0800</pubDate>   
  </item>
    <item>
   <title>centos 7 安裝筆記</title>
   <description> 
安裝 cento7 後,先關閉兩個安全網管程序,比較好 debug
 
 
	 Selinux
	 
	vi /etc/selinux/config
	 
	SELINUX=enforce 修改成：SELINUX=disable
	 
	#SELINUXTYPE=targeted
	 
	 關閉防火牆
	 
	systemctl stop firewalld
	 
	系統開機時不啟動防火牆
	 
	systemctl disable firewalld
	 
 
設定好這兩個,重新開機就可以了 
 
 </description>
   <link>http://120.112.17.17/blog/shyong/archives/542</link>
      <pubDate>Wed, 27 Apr 2016 10:10:36 +0800</pubDate>   
  </item>
    <item>
   <title>systemctl 簡易使用</title>
   <description>動作   服務名.service 
 
一些centos7 systemctl命令簡單實用實例:
 
 
systemctl   start   httpd.service /啟動Apache httpd
 
 
systemctl   restart httpd.service /重新啟動
 
 
systemctl   stop    httpd.service /停止服務
 
 
systemctl   enable httpd.service  /開機啟動httpd
 
 
systemctl  disable httpd.service  /禁止開機啟動httpd
 
 

 
 
systemctl status httpd  /顯示服務狀態
 
 
systemctl is-active httpd  /顯示服務狀態
 
 
systemctl list-unit-files | grep httpd  /列出 httpd Server 啟動狀態
 
 
參考:http://www.vpsboke.com/manage/centos7-service-systemctl-command/ 
 </description>
   <link>http://120.112.17.17/blog/shyong/archives/539</link>
      <pubDate>Mon, 22 Feb 2016 10:07:38 +0800</pubDate>   
  </item>
    <item>
   <title>postfix 設定只能收信不能寄信</title>
   <description> 
首先建立了一個/etc/postfix/reject_user, 填入要封鎖的帳號資料, 建立該db檔.
 
然後編輯 vi /etc/postfix/ main.cf , 並將加入check_sender_access hash:/etc/postfix/reject_user在下面兩項敘述中
 
 
#若有其它設定用逗點分隔 
 
smtpd_recipient_restrictions =  check_sender_access hash:/etc/postfix/reject_user,&nbsp;  permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
  
 
smtpd_sender_restrictions =  check_sender_access hash:/etc/postfix/reject_user 
 
 
 
vi /etc/postfix/reject_user&nbsp;
 
# REJECT 退信 , DISCARD 丟棄&nbsp; 
 
user@test.com.tw  REJECT
 
user2@&nbsp; DISCARD
 
 
#建立map db檔
 
postmap hash:/etc/postfix/reject_user
 
 
重新啟動postfix
 
/etc/init.d/rd.d/postfix restart
 </description>
   <link>http://120.112.17.17/blog/shyong/archives/538</link>
      <pubDate>Thu, 28 Jan 2016 19:36:27 +0800</pubDate>   
  </item>
    <item>
   <title>centos shell script 更改 passwd 密碼 , samba 密碼</title>
   <description> 
centos 6 以後可以用的 passwd 更改
 
&nbsp;==&gt;&nbsp; printf &quot;$pass&quot; | passwd --stdin $user
 
 
samba 密碼更改
 
&nbsp;==&gt;  printf &quot;$pass\n$pass\n&quot; | smbpasswd -a -s $user
 </description>
   <link>http://120.112.17.17/blog/shyong/archives/532</link>
      <pubDate>Wed, 28 Oct 2015 22:06:36 +0800</pubDate>   
  </item>
    <item>
   <title>linux 中斷連線</title>
   <description> 
想中斷連線,找到的方法用&nbsp; netstat -tp&nbsp; 加 p 參數可以顯示 pid ,然後用 kill -9 pid 將連線中止就可以了
 
 
&nbsp;
 </description>
   <link>http://120.112.17.17/blog/shyong/archives/529</link>
      <pubDate>Wed, 12 Aug 2015 21:44:18 +0800</pubDate>   
  </item>
    <item>
   <title>ssh 設定 chroot 的方法</title>
   <description>openssh 4.8p1以後，chroot功能已經被內置了,使用方法如下:
 
1.建立 chroot 環境  dir.sh 
 
2.建立可用指令環境  cmd.sh 
 
3.建立使用者  user.sh 
 
4.修改 /etc/ssh/sshd_config 的設定
 
Match User foo 
ChrootDirectory /var/chroot 
 
也可以Match Group，舉例如下: 
Match Group sftponly 
&nbsp;&nbsp;&nbsp; PasswordAuthentication yes 
&nbsp;&nbsp;&nbsp; AllowAgentForwarding no 
&nbsp;&nbsp;&nbsp; AllowTcpForwarding no 
&nbsp;&nbsp;&nbsp; ChrootDirectory /var/chroot
 
網上看到有加 %u =&gt;&nbsp; ChrootDirectory /var/chroot/%u測試結果錯誤,將 %u取消才可以
 
參考自 : http://blog.sina.com.cn/s/blog_6e0c0fdf01019zw5.html
 </description>
   <link>http://120.112.17.17/blog/shyong/archives/526</link>
      <pubDate>Wed, 27 May 2015 19:21:28 +0800</pubDate>   
  </item>
   </channel>
</rss>

