Powered By Blogger
Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

10 March 2012

สร้าง user บน pure-ftpd (ubuntu )

ใน pure-ftpd จะมีคำสั่งสร้าง user
และระุบุให้ผูกกับ  user ของ OS
ดังนี้
http://support.real-time.com/open-source/pureftpd/index.html
โดยห้าม ใช้  uid OS  ซีึ่งเป็น "root" และ   "gid" เป็น root
ทำให้ต้องมีการ สร้าง user ของ OS ใหม่

การสร้าง user ใหม่ ใน ubuntu
ลองสร้างดูด้วย วิธีนี้

useradd  ซับซ้อนหน่อย ต้องระบุ path ให้ แล้วต้องมากำหนด password ด้วย  "passwd"  อีกครั้ง
adduser เหมือนมี text gui มาช่วยให้ป้อนค่าต่างๆง่ายมากๆ
http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/

หรือหากจะสร้าง ด้วย gui ก็ตามนี้ครับ
http://blog.it.kmitl.ac.th/it51070105/2008/07/10/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%AA%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%87-user-%E0%B9%83%E0%B8%99-ubuntu/

สมมุติ สร้าง user ของ OS ชื่อ tu2 มาแล้ว

ขั้นตอนที่จะสร้าง user ของ  pure-ftpd ก็จะทำตามเอกสารนี้
http://download.pureftpd.org/pub/pure-ftpd/doc/README.Virtual-Users
แต่จะปรับเปลี่ยนเล็กน้อย คือ

ที่ path
root@root: /etc/pure-ftpd#
รันคำสั่งดังนี้
#groupaddd   ftpgroup
#useradd  -g ftpgroup  -d /home/ftpuser -s  /etc  ftpuser
#pure-pw  useradd   tu2  -u ftpuser  -d  /home/ftpuser/joe
ใส่พาสเวิร์ด สองครั้ง
เป็นการผูก  user:OS  tu2 เข้ากับ  user (อ่านรีบๆเดาว่าน่าจะเป็น) แบบ virtual user "ftpuser"
และกำหนดให้ path ของ directory เป็น /home/ftpuser/joe


แต่ว่าใส่ผิด ชื่อไม่ตรง คือใส่ joe ต้องการ ลบ user นี้ออกจาก ftp เพื่อจะเปลี่ยน folder ที่เก็บ
#pure-pw  userdel  tu2

#pure-pw  useradd   tu2  -u ftpuser  -d  /home/ftpuser/tu2
ใส่ password สองครั้ง


จะทำให้ สามารถ logon จาก  core FTP ( windows )
ได้ โดย ใช้ user tu2
ซึ่งเป็นการ เปิด จาก port 21

 ถ้าจะใ้ห้ ปลอดภัยขึ้นควร ใช้ SSH แทน ซึ่งเป็น port 22 จะปลอดภัย มีการเข้ารหัสข้อมูล
 ซึ่ง port 21 แบบ FTP นี้ ไม่มีการเข้ารหัสข้อมูลใดๆ ทั้งสิ้น

 แต่ในที่นี้ สอน การใช้งานแบบง่ายๆ ในหน่วยงาน หรือ สำหรับ Test Server
 หรือ ใช้ ภายใน VMware / VirtualBox เป็นหลัก ( ผมก็ ใช้เพื่อการนี้แหละ ... แบบ Host - Only ด้วย )

------------------------
ผลลัพธ์ หลังจากลองแบบ รีบด่วนแล้ว
พบว่า  login ftp ได้ที่  /home/tu2
ซึ่งก็พบว่า  ใช้ CoreFTP (windows )  โหลด ไฟล์จาก   Pure-ftpd (Ubuntu ) ได้
และยังสามารถ ส่งไฟล์จาก  CoreFTP (windows )  ไปยัง   Pure-ftpd (Ubuntu ) ได้ ด้วย
โดยจะส่งไปวางไว้ที่  /home/tu2

ซึ่งก็จะเป็นวิธีการ รับส่งไฟล์แบบง่ายๆ ในสภาพแวดล้อมที่  มีความเสี่ยงต่ำ
ระหว่าง  linux กับ  windows

... อืม ... อาจมีวิธีง่ายกว่านี้ แต่นึกไม่ออก น่ะ    :D

10 October 2010

setup apache2 on ubuntu-server 6

************************************************************************
Note by Thitipong samranvanit  
Ubuntu Server , Install with LAMP 
Sun VM VirtualBox , ver 3.2.8 
Date  9 / 10 / 2010   
Document tools : Ubuntu Server + vi  ( 6 )
************************************************************************
I download LiveCD-Server6 from Ubuntu 
and Install In HD ( Oracle VirtualBox )

set ipconfig by  

 # ifconfig eth0 192.168.1.102  netmask 255.255.255.0  up 

set default gateway by 
 # route add default via 192.168.1.1 

In my machin  use  Oracle VirtualBox 

1 NetworkCard is Bridge Mode , Adapter1 as Bridge Adapter , Cable Connected
2 , Adapther 2 as NAT  , Cable not connected

I start ping gateway by ping  192.168.1.1 
and after success , then ping  www.google.co.th

end ping process by  Ctrl + C  (  must  LEFT Ctrl in VirtualBox  )

******************************
Apache2
******************************
Apache2 is in /etc/Apache2
config not in  /etc/apache2/httpd.conf
But  config in /etc/apache2/apache2.conf 

root directory is in 
/var/www 

You must copy file from  /var/www/default-www/*.html.en  to  /var/www by "cp"
and copy *.gif ,*.png from /var/www/default-ww/*.* to /var/www
then rename *.html.en to *.html   by  command "mv"    

then  open browser on host PC ( ex. Windows XP + Chrome ) 
and   enter url  http://192.168.1.102   
then  you will find  Apache page 

start/stop apache2 by
# /etc/init.d/apache2 start 
# /etc/init.d/apache2 stop 
or you can use "sudo" if you not root
$sudo /etc/init.d/apache2 start 
( must enter password of root again ) 


*********************************
To Test PHP 
*********************************
Create 1 file named  phpinfo.php
add this below code


end then  save in  /var/www

open browser in Host File to browse file 
http://192.168.1.102/phpinfo.php

***********************************
Test Mysql
***********************************
mysql is in /etc/mysql  
with config file my.cfg

Can check mysql by run at prompt 
#mysql  {enter}   to run mysql client 
if mysql server running (by default ) 
it will connect to mysql server database
mysql> 

run command to show database by 
mysql>show databases;
will list database 

(now mysql is part of Oracle ) 

***********************************
SYSTEM 
***********************************
hostname can view by command 
#cat /etc/hostname 

installing new software
apt-get install [pacakge] 
this command may tell you unknown .

use aptitude for more information 
#aptitude install [pacakge]
or user 
#aptitude   
to display  GUI (text mode) on Linux 
quit gui by "q"  
user F1  on keyboard for help

for Searching package use "/"
searching Apache2 may use 
"apache"  or "httpd" , in this machin 
found  "apache" 

you will find description of many program
on aptitude 
( most linux program name very unclear for WinXP user)

***********************************
Download File
***********************************
you can download file with 
wget ( see in aptitude ) 

***********************************
NOTE: in this Ubuntu Server (TextMode Only ) 
,there is no other files in /var/www  
***********************************