2013年3月23日 星期六

vsftp的安裝

安裝ubuntu miniserver 12.04
其中vsftpd總是無法順利完成
1,重新安裝vsftpd的指令
sudo apt-get remove --purge vsftpd
sudo apt-get install vsftpd
2,重新啟動
sudo /etc/init.d/vsftpd start
3,設定檔在   /etc/vsftpd.conf
其中比較要注意的是幾個設定值
例如:(拿掉#)
  • 將使用者限定在家目錄中   chroot_local_user = YES
  • 可否寫入write_enable=YES
  • 任何入讀取匿名ftp資料夾  anonymous_enable=YES
4,匿名ftp預設登入目錄為  /srv/ftp


*******參考文件***********************************


500 OOPS: vsftpd: refusing to run with writable root inside chroot()


This is one of the most annoying and frustrating problems I have run into lately. This supposed security fix makes vsftp simply unusable after upgrading to Ubuntu 12.04 from 10.04. No amount of cajoling or messing with options will get it working again.
The fix is pretty easy though, just copy/paste these lines into a terminal. It will update your /etc/vsftpd.conf that stopped working after you upgraded.
This has been tested and works on Ubuntu 12.04


wget http://http.us.debian.org/debian/pool/main/v/vsftpd/vsftpd_3.0.2-2_amd64.deb
dpkg -i vsftpd_3.0.2-2_amd64.deb
echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf
service vsftpd reload


*******參考文件***********************************
這是新版的 vsftpd 又增加了安全性的設定了,它不允許你的根目錄的權限設定是可以寫入的




所以你必須把該使用者的家目錄,可寫入的權限拿掉才能正常的登入
chmod a-w /home/user

*******參考文件***********************************
Before you close this out to repetition, I have been researching all of the proposed solutions to this bug and so far I have been unable to keep a FTP user jailed to their website directory. While I am not a ubuntu server expert, I wanted to reach out to the community to see if anyone has found a solution that both fixes this bug and keeps the user jailed to their directory.
My vsftpd settings that I changed:
listen_port=9000
Set: anonymous_enable=NO 
Uncomment: local_enable=YES 
Uncomment: write_enable=YES 
Uncomment: local_umask=022 
Set: connect_from_port_20=NO 
Uncomment: idle_session_timeout=600
Uncomment: data_connection_timeout=120 
Comment out: #ftpd_banner=Welcome to blah FTP service. [should be on line 104]
Added: banner_file=/etc/issue.net 
Uncomment: chroot_local_user=YES
Uncomment: chroot_local_user=YES 
Uncomment: chroot_list_enable=YES 
Uncomment : chroot_list_file=/etc/vsftpd.chroot_list
At the end of the file I added:

# Show hidden files and the "." and ".." folders.
# Useful to not write over hidden files:
force_dot_files=YES

# Hide the info about the owner (user and group) of the files.
hide_ids=YES

# Connection limit for each IP:
max_per_ip=10

# Maximum number of clients:
max_clients=5

# FTP Passive Settings
pasv_enable=YES
#If your listen_port is 9000 set this range to 7500 and 8500
pasv_min_port=[port range min]
pasv_max_port=[port range max]
The user in question mybloguser is jailed to her website directory under /srv/www/myblog and this user is not part of the nano /etc/vsftpd.chroot_list file. The user’s home directory is also /srv/www/myblog which used to work in the past.
I tried the allow_writeable_chroot=YES solution which did not work, and actually broke vsftpd completely.

2013年3月19日 星期二

學校網路不通SOP

好啦,網路不通,校務就停擺
吔!萬歲~

1.首先確認別台PC是否可以正常連線?

2.別台正常,本機No 
   ----> 檢查網路線是否鬆脫?
           那條網路線有沒壞?
           Hub連接點檢查?
           重新開關機Switch?
           檢查網路設定?
          (最痛恨不知道在那裡“物理性”斷線)

3.檢查IP是否設定正確或有無抓取到IP
   -----> ipconfig 

4.連續多台PC皆No,則再確認是問題來自校內還是校外?
   -----> ping 163.26.139.254  (測試學校的Gateway IP )

5.檢查本機到中華電信的route (還在使用臺華防火牆的學校 
   -----> traceroute 168.95.1.1   (168.95.1.1是Hinet的DNS)
            可以查看網路斷在哪個路由器

6.ping 168.95.1.1 有問題,表示防火牆有問題
   ----->重開關機防火牆(最好連所有的Hub,Switch都給斷電休息一下)
           再電請市網確認連線狀況(網路電話69094網路連線組)
           都不通了,還打?
           所以應該是2130669五妃街那間。

7.ping 168.95.1.1 沒問題,開始查校內主機
    
   DNS問題     ----> 網頁開啓 210.65.1.231 (Hinet首頁)或學校163.26.139.129
   DHCP問題  ---->......
    .........
     
   啊~重新開機
   不然,再安裝復原啦

    有時候
    砍掉重練是最能節省時間精力的好方法之一


補充: 
1.中華電信佳里服務站電話--->
2.市網電話:2130669 
3.市網文件:另外一個常見的狀況是學校某台電腦突然無法上網,更換IP後正常,
                    但沒多久又無法正常對外連線,只能瀏覽中心網站,發生這樣的狀況
                    多半是電腦中毒,10分鐘內對多個不同IP連線,被中心的自動阻斷機制
                    限制存取。 

2013年3月18日 星期一

Ubuntu miniserver 的防火牆

啓用--> sudo ufw enable
關閉-->  sudo ufw disable
查看目前防火牆規則-->  sudo ufw  status
查規則編號-->   sudo ufw status numbered

例如:
開啓http的port
ufw allow http   或  ufw allow 80

刪除某條規則
ufw delete  規則編號

限制port 22 在某網段內
sudo ufw allow from 163.26.139.128/25 to 163.26.139.254/25 port 22

不過,ufw也有人寫出圖形介面-->Gufw
在偏好設定中,選防火牆規則的圖示
點按執行

2013年3月11日 星期一

Ubuntu miniserver 開啟各項服務

Ubuntu miniserver 開啟各項服務的方法:
都在/opt/tools/Server 資料夾中

動態IP分配   --->  endhcpd.sh
DNS服務       --->  endns.sh
Web網站       --->  enhttps.sh
Mysql資料庫 --->  enMysql.sh
FTP檔案傳輸  --->  envsftpd.sh
等等...

例如重新啟動DHCP,可以下以下指令:

/opt/tools/Server/endhcpd.sh 

當然你得有root的權限
過程中需鍵入相關資料喔