<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SpaLinux.com &#187; Users</title>
	<atom:link href="http://spalinux.com/category/users/feed" rel="self" type="application/rss+xml" />
	<link>http://spalinux.com</link>
	<description>Resources for Relaxing Linux System Administrators</description>
	<lastBuildDate>Sat, 21 Jan 2012 16:07:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>รันโปรเซสเป็น user อื่น</title>
		<link>http://spalinux.com/2010/03/run_process_as_another_user</link>
		<comments>http://spalinux.com/2010/03/run_process_as_another_user#comments</comments>
		<pubDate>Sat, 06 Mar 2010 05:52:51 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Linux Shell]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Users]]></category>
		<category><![CDATA[Utility]]></category>
		<category><![CDATA[unix process]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=1088</guid>
		<description><![CDATA[เป็นวิธีง่ายๆ เพื่อให้ผู้ใช้ root สามารถรันโปรเซสหรือโปรแกรมบน Linux/UNIX ภายใต้สิทธิหรือ permission ผู้ใช้ user อื่นบนเครื่องเดียวกัน คำสั่งที่ใช้คือ su ตามด้วยออปชั่น &#8216;-c&#8217; รูปแบบการใช้คำสั่งคือ # su - &#60;user_name&#62; -c "&#60;command&#62;" ตัวอย่าง root รันคำสั่ง id ภายใต้สิทธิผู้ใช้ชื่อ user1 # su - user1 -c "id" uid=501(user1) gid=100(users) groups=100(users) ข้อมูลอ้างอิง &#8216;su&#8217; man page]]></description>
			<content:encoded><![CDATA[<p>เป็นวิธีง่ายๆ เพื่อให้ผู้ใช้ root สามารถรันโปรเซสหรือโปรแกรมบน Linux/UNIX ภายใต้สิทธิหรือ permission ผู้ใช้ user อื่นบนเครื่องเดียวกัน</p>
<p><span id="more-1088"></span>คำสั่งที่ใช้คือ su ตามด้วยออปชั่น &#8216;-c&#8217; รูปแบบการใช้คำสั่งคือ</p>
<pre># su - &lt;user_name&gt; -c "&lt;command&gt;"</pre>
<p>ตัวอย่าง root รันคำสั่ง id ภายใต้สิทธิผู้ใช้ชื่อ user1</p>
<pre># <strong>su - user1 -c "id"
</strong>uid=501(user1) gid=100(users) groups=100(users)</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li>&#8216;su&#8217; man page</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2010/03/run_process_as_another_user/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>คำสั่ง net เพิ่ม,ลบ user บน Windows XP</title>
		<link>http://spalinux.com/2009/06/net_command_to_add_delete_user_on_windows_xp</link>
		<comments>http://spalinux.com/2009/06/net_command_to_add_delete_user_on_windows_xp#comments</comments>
		<pubDate>Sat, 06 Jun 2009 08:51:24 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Users]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[add user]]></category>
		<category><![CDATA[windows xp]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=745</guid>
		<description><![CDATA[อาจเนื่องมาจากคุ้นเคยกับการใช้คำสั่ง command line บนลีนุกซ์ หรือ UNIX เพื่อแก้ไขคอนฟิกต่างๆ ของเครื่องเป็นเวลานาน เมื่อต้องมาทำบน Windows เช่นครั้งนี้ได้รับมอบหมายงานให้เพิ่ม local user จำนวนมากบนเครื่อง Windows XP หลายๆ เครื่อง แต่ห้ามคอนฟิกเป็น domain controller จึงหาวิธีการทำโดยใช้การรันคำสั่ง command line บน Windows จากการค้นหาบน google มีอยู่หลากหลายวิธีที่จะเพิ่ม local user ได้ ทั้งการเขียนโปรแกรม สร้าง WSH (Windows Script Host) หรือล่าสุดที่ทาง Microsoft นำเสนอทางเลือกใหม่คือ Windows PowerShell แต่ดูแล้วค่อนข้างจะยุ่งยาก บางอย่างเช่น Windows PowerShell ต้องมีการติดตั้งโปรแกรมใหม่ ซึ่งทางลูกค้าไม่ต้องการให้เป็นเช่นนั้น สุดท้ายมาลงเอยโดยใช้คำสั่ง net ซึ่งมีติดตั้งมาอยู่แล้วกับ Windows XP ทางผู้เขียนเพิ่งทราบเหมือนกันว่า [...]]]></description>
			<content:encoded><![CDATA[<p>อาจเนื่องมาจากคุ้นเคยกับการใช้คำสั่ง command line บนลีนุกซ์ หรือ UNIX เพื่อแก้ไขคอนฟิกต่างๆ ของเครื่องเป็นเวลานาน เมื่อต้องมาทำบน Windows เช่นครั้งนี้ได้รับมอบหมายงานให้เพิ่ม local user จำนวนมากบนเครื่อง Windows XP หลายๆ เครื่อง แต่ห้ามคอนฟิกเป็น domain controller จึงหาวิธีการทำโดยใช้การรันคำสั่ง command line บน Windows</p>
<p>จากการค้นหาบน google มีอยู่หลากหลายวิธีที่จะเพิ่ม local user ได้ ทั้งการเขียนโปรแกรม สร้าง WSH (Windows Script Host) หรือล่าสุดที่ทาง Microsoft นำเสนอทางเลือกใหม่คือ Windows PowerShell</p>
<p>แต่ดูแล้วค่อนข้างจะยุ่งยาก บางอย่างเช่น Windows PowerShell ต้องมีการติดตั้งโปรแกรมใหม่ ซึ่งทางลูกค้าไม่ต้องการให้เป็นเช่นนั้น</p>
<p>สุดท้ายมาลงเอยโดยใช้คำสั่ง net ซึ่งมีติดตั้งมาอยู่แล้วกับ Windows XP ทางผู้เขียนเพิ่งทราบเหมือนกันว่า สามารถใช้คำสั่งนี้ เพิ่มลบ user ได้ รวมทั้งสามารถคอนฟิกอื่นๆ ได้อีกด้วย</p>
<p><span id="more-745"></span></p>
<h4>วิธีการรันคำสั่ง net</h4>
<p>ล็อกอินเป็น Administrator หรือมีสิทธิเทียบเท่า เพื่อแก้ไข user account ได้</p>
<p>เพื่อความสะดวกในการทดลอง แนะนำให้เปิด command line ของ Windows ก่อน โดยสามารถรันได้จากคลิ้ก Start -&gt; Run พิมพ์คำว่า cmd ในช่อง Open แล้วกดปุ่ม [OK}</p>
<p><img class="alignnone size-full wp-image-748" title="Start -&gt; Run -&gt; cmd" src="http://spalinux.com/wp-content/uploads/2009/06/01-start-run-cmd.png" alt="Start -&gt; Run -&gt; cmd" width="347" height="187" /></p>
<p><img class="alignnone size-full wp-image-749" title="Windows cmd" src="http://spalinux.com/wp-content/uploads/2009/06/02-windows-cmd.png" alt="Windows cmd" width="671" height="340" /></p>
<p>พิมพ์คำสั่ง net หน้าจอจะแสดง syntax ในการรันคำสั่งต่างๆ ซึ่งแยกตามหมวดต่างๆ</p>
<pre>C:\Documents and Settings\Administrator&gt; <strong>net</strong>
The syntax of this command is:</pre>
<pre>NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |
      HELPMSG | LOCALGROUP | NAME | PAUSE | PRINT | SEND | SESSION |
      SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]</pre>
<p>ในที่นี้เราจะจัดการเกี่ยวกับ user สามารถพิมพ์คำสั่ง net user "/?" เพื่อแสดงวิธีการใช้คำสั่งเกี่ยวกับ user</p>
<pre>C:\Documents and Settings\Administrator&gt; <strong>net user /?
</strong>The syntax of this command is:</pre>
<pre>NET USER
[username [password | *] [options]] [/DOMAIN]
         username {password | *} /ADD [options] [/DOMAIN]
         username [/DELETE] [/DOMAIN]</pre>
<p>หากต้องการรายละเอียดมากขึ้นเกี่ยวกับการใช้คำสั่ง ให้พิมพ์ต่อท้ายด้วย "/help"</p>
<pre>C:\Documents and Settings\Administrator&gt; <strong>net user /help
</strong>The syntax of this command is:</pre>
<pre>NET USER
[username [password | *] [options]] [/DOMAIN]
         username {password | *} /ADD [options] [/DOMAIN]
         username [/DELETE] [/DOMAIN]</pre>
<pre>NET USER creates and modifies user accounts on computers. When used
without switches, it lists the user accounts for the computer. The
user account information is stored in the user accounts database.</pre>
<pre>This command works only on servers.</pre>
<pre>username     Is the name of the user account to add, delete, modify, or
             view. The name of the user account can have as many as
             20 characters.
password     Assigns or changes a password for the user's account.
             A password must satisfy the minimum length set with the
             /MINPWLEN option of the NET ACCOUNTS command. It can have as
             many as 14 characters.
*            Produces a prompt for the password. The password is not
             displayed when you type it at a password prompt.
/DOMAIN      Performs the operation on a domain controller of
             the current domain.
/ADD         Adds a user account to the user accounts database.
/DELETE      Removes a user account from the user accounts database.</pre>
<pre>...</pre>
<h4>ใช้คำสั่ง net user เพิ่ม user</h4>
<p>วิธีการใช้คำสั่งเพื่อเพิ่ม user (add user) ใหม่เข้าไปในเครื่อง ทำได้โดยพิมพ์ net user แล้วตามด้วย username ที่ต้องการเพิ่ม ต่อด้วย password แล้วลงท้ายด้วย "/add"</p>
<p>เช่นต้องการเพิ่มชื่อ "user1" และตั้งรหัสผ่านเป็น "password1" ต้องรันคำสั่งดังนี้</p>
<pre>C:\Documents and Settings\Administrator&gt; <strong>net user user1 password1 /add
</strong>The command completed successfully.</pre>
<p><strong>หมายเหตุ</strong> การรันคำสั่ง net ทุกครั้ง ต้องขึ้นว่า "The command completed successfully" เพื่อแสดงว่าเราใช้คำสั่งได้ถูกต้อง ตามรูปแบบการใช้</p>
<p>แต่ถ้าต้องการให้ขึ้นพิมพ์รหัสผ่าน เหมือนการรันคำสั่ง passwd บนลีนุกซ์ ให้ใส่ช่องรหัสผ่านเป็นเครื่องหมาย "*" แล้วโปรแกรมจะขึ้นให้ใส่รหัสผ่านสองครั้งเพื่อตั้งรหัส</p>
<pre>C:\Documents and Settings\Administrator&gt; <strong>net user user2 * /add
</strong>Type a password for the user:
Retype the password to confirm:
The command completed successfully.</pre>
<h4>ใช้คำสั่ง net user ดูข้อมูล user</h4>
<p>เราสามารถใช้คำสั่ง net user ตามด้วยชื่อ username เพื่อดูข้อมูลของผู้ใช้ได้</p>
<pre>C:\Documents and Settings\Administrator&gt; <strong>net user user1
</strong>User name                    user1
Full Name
Comment
User's comment
Country code                 000 (System Default)
Account active               Yes
Account expires              Never</pre>
<pre>Password last set            6/6/2009 3:27 PM
Password expires             7/19/2009 2:15 PM
Password changeable          6/6/2009 3:27 PM
Password required            Yes
User may change password     Yes</pre>
<pre>Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   Never</pre>
<pre>Logon hours allowed          All</pre>
<pre>Local Group Memberships      *Users
Global Group memberships     *None
The command completed successfully.</pre>
<p>หากต้องการตรวจสอบว่าคำสั่งสามารถเพิ่ม user ได้ถูกต้องหรือไม่สามารถเปรียบเทียบกับ User Accounts ใน Control Panel โดยดีฟอลต์ user ที่ถูกเพิ่มจะถูกเซ็ตให้อยู่ในกลุ่ม (Group) "Users"</p>
<p><img class="alignnone size-full wp-image-750" title="Windows Control Panel - User Accounts" src="http://spalinux.com/wp-content/uploads/2009/06/03-control-panel-user-accounts.png" alt="Windows Control Panel - User Accounts" width="407" height="456" /></p>
<h4>ใช้คำสั่ง net user ลบ user</h4>
<p>หากต้องการลบ user ออกจากเครื่อง ให้พิมพ์คำสั่ง net user ตามด้วยชื่อ user ลงท้ายด้วย "/delete"</p>
<p>ตัวอย่างเช่น ต้องการลบ user1 สามารถทำได้โดย</p>
<pre>C:\Documents and Settings\Administrator&gt; <strong>net user user1 /delete
</strong>The command completed successfully.</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_user.mspx?mfr=true" target="_blank">Microsoft Windows XP - Net user</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/06/net_command_to_add_delete_user_on_windows_xp/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

