SoftGanz By Little Bear.

Web & Software Developer Gang.

Server Setup : การกำหนดสิทธิ์ Root ให้กับ user บน Ubuntu 14.04

โดย Little Bear on December,22 2014 21.45

Pre-Flight Check

  • These instructions are intended specifically for adding a user on Ubuntu 14.04 LTS.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 14.04 LTS server, and I’ll be logged in as root.

Step 1: Add the User

It’s just one simple command to add a user. In this case, we’re adding a user called mynewuser :

adduser mynewuser

First you will be prompted to enter the user’s password (twice); do this step. Next you’ll be prompted to enter in the user’s information. This step is not required, and pressing enter fills the field with the default information:

Adding user `mynewuser’ …
Adding new group `mynewuser’ (1001) …
Adding new user `mynewuser’ (1001) with group `mynewuser’ …
Creating home directory `/home/mynewuser’ …
Copying files from `/etc/skel’ …
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for mynewuser
Enter the new value, or press ENTER for the default
Full Name []: User
Room Number []:
Work Phone []:
Home Phone []:
Other []:

When prompted with the following question, enter Y then hit enter to continue.

Is the information correct? [Y/n] Y

Step 2: Grant Root Privileges to the User


Find the following code:

# User privilege specification

In this case, we’re granting root privileges to the user mynewuser . Add the following below that code:

mynewuser ALL=(ALL:ALL) ALL

Then exit and save the file with the key commands Ctrl-x, Y, enter.

If you’ve followed the instruction above correctly, then you should now have a user setup by the name of mynewuser which can use sudo to run commands as root!

ที่มา How to Add a User and Grant Root Privileges on Ubuntu 14.04

Setup FTP Server under Ubuntu/Debian

โดย Little Bear on December,22 2014 21.35

เก็บไว้ก่อน เดี๋ยวค่อยมาแปลและเขียนใหม่นะครับ

This article contains a brief introduction to set up an FTP-Server under Debian Linux. Activation of an FTP server should be done similarly with other distributions of Linux. Debian 5.0 (x86) was used as the test system.


  1. Installation of the required proftpd Package
  2. Adjusting the Configuration
  3. Anonymous FTP
  4. Re-loading the Configuration and Re-starting the FTP Server
  5. Links

Installation of the required proftpd Package

ProFTPd FTP-Server was used for this introduction because of its simply installation and configuration.

apt-get install proftpd

If the package cannot be found, update the local list of packages using:

apt-get update

If the package still cannot be installed after that, check the /etc/apt/sources.list on the appropriate Debian mirror server. You will find more information about this in the article Debian Mirror.

Indicate in the subsequent inquiry whether the FTP server should act as a standalone server (standalone) or as a service of inetd. In this example, the standalone option has been selected. Adjusting the Configuration

Our configuration assumes that we will login using system users found in the ftpuser group.

In order to adjust the configuration to your needs, edit the /etc/proftpd/proftpd.conf file.

If you are not using IPv6, this feature should be deactivated first:

UseIPv6 off

After that, we will add the following instruction at the end of the file:

&nbsp; &nbsp; RequireValidShell off

DefaultRoot ~ ftpuser

<Limit LOGIN>
&nbsp; &nbsp; DenyGroup !ftpuser

What do the instructions mean?

As a first step, we told ProFTPd that users wanting to login do not need a shell. Afterwards, we instructed ProFTPd to lock users in their home directory using DefaultRoot. Finally, we specified that only those users who are members of the ftpuser group could login.

We will now restart our FTP server so that our configuration takes effect:

/etc/init.d/proftpd restart

Then, we will create the ftpuser group and a first user that will be able to login.

addgroup ftpuser

Now, we create the user:

adduser ftpbenutzer -shell /bin/false -home /var/www

Finally, we assign the user to the ftpuser group:

adduser ftpbenutzer ftpuser

That’s everything. You should now be able to login with the user via FTP.

You have to run sudo deluser username groupname to delete a user from it's corresponding group. And run this sudo deluser --group groupname command to delete a group.

Anonymous FTP

By adding the following section to the etc/proftpd/proftpd.conf file, you will also give anonymous users (read) access to the FTP area:

<Anonymous ~ftp>
&nbsp; User&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ftp
&nbsp; Group&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  nogroup
&nbsp; # We want clients to be able to login with "anonymous" as well as "ftp"
&nbsp; UserAlias&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  anonymous ftp
&nbsp; # Cosmetic changes, all files belong to ftp user
&nbsp; DirFakeUser&nbsp;  on ftp
&nbsp; DirFakeGroup on ftp

&nbsp; RequireValidShell&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  off

&nbsp; # Limit the maximum number of anonymous logins
&nbsp; MaxClients&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 10

&nbsp; # We want 'welcome.msg' displayed at login, and '.message' displayed
&nbsp; # in each newly chdired directory.
&nbsp; DisplayLogin&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; welcome.msg
&nbsp; DisplayFirstChdir&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .message

&nbsp; # Limit WRITE everywhere in the anonymous chroot
&nbsp; <Directory *>
&nbsp; &nbsp; <Limit WRITE>
&nbsp; &nbsp; &nbsp; DenyAll
&nbsp; &nbsp; </Limit>
&nbsp; </Directory>

#&nbsp;  # Uncomment this if you're brave.
#&nbsp;  # <Directory incoming>
#&nbsp;  #&nbsp;  # Umask 022 is a good standard umask to prevent new files and dirs
#&nbsp;  #&nbsp;  # (second parm) from being group and world writable.
#&nbsp;  #&nbsp;  Umask&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  022&nbsp; 022
#&nbsp;  #&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <Limit READ WRITE>
#&nbsp;  #&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DenyAll
#&nbsp;  #&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </Limit>
#&nbsp;  #&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <Limit STOR>
#&nbsp;  #&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AllowAll
#&nbsp;  #&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </Limit>
#&nbsp;  # </Directory>


To make sure, that user "ftp" is able to login anonymously to ftp-space, you have to add the user to the group "ftpuser":

adduser ftp ftpuser

Re-loading the Configuration and Re-starting the FTP Server

The configuration will have to be re-loaded after the adjustments to the /etc/proftpd/proftpd.conf file:

/etc/init.d/proftpd reload

Because the FTP server will be stopped when re-loading the configuration, it will also have to be re-started afterwards:

/etc/init.d/proftpd start


Android : Input type="file" ไม่ทำงานบน webView

โดย Little Bear on December,21 2014 16.29

เพิ่งเขียนให้ app สามารถรายงานสถานการณ์ พร้อมอัพโหลดภาพได้ และรายงานระดับน้ำจากสมาชิกด้วย แต่ติดว่าเมื่อกดปุ่มเลือกไฟล์ภาพจากกล้อง ด้วย tag input type="file" จะไม่เด้งหน้าเลือกไฟล์มาให้

คำแนะนำคือให้เปลี่ยนไปใช้ WebChromeClient แทน แก้ไขตามตัวอย่าง หรือไปดูจากที่มาได้เลยครับ

Bug : isset($body['location']) ดันเป็นจริงเมื่อ $body ไม่ใช่ array

โดย Little Bear on December,09 2014 10.56

งมหาเรื่องแปลกอยู่หลายอาทิตย์ วันนี้เลยตามหาว่าเกิดอะไรขึ้นกับโปรแกรม PHP ที่เขียนบน Linux และไม่เคยทดสอบบน Windows เมื่อเอามาติดตั้งก็เลยเกิด error แปลก

ปรากฏว่า คำสั่ง isset($body['location']) ดันเป็นจริงเมื่อ $body ไม่ใช่ array ทำให้เช็คเงื่อนไขผิดพลาด

แก้ไข : ตรวจสอบด้วยว่าเป็น array หรือไม่

if ( is_array($body) && isset($body['location']) ) then ;Do something

Material Design : นำเสนอหลักการและวิธีการออกแบบ Material Design ผ่าน Slide

โดย Little Bear on December,07 2014 10.01

หลังจากที่ Google ได้ปรับแนวทางการออกแบบ Mobile Application และปรับมาจนถึงเว็บไซท์ ให้มาใช้แนวทางของ Material Design ก็มีคนออกมาให้คำแนะนำและสอนวิธีการกันมากมาย

เว็บ ก็เป็นอีกเว็บหนึ่งที่นำเสนอในรูปแบบของ Slide ให้เราลองศึกษากันเป็นขั้นตอนที่จะเข้าใจได้ง่ายขึ้น ลองตามไปอ่านดูนะครับ ที่ Google Material Design

514 items|« First « Prev 5 6 (7/103) 8 9 Next » Last »|