<?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>เพื่อชีวิตที่ผ่อนคลายของคนใช้ลีนุกซ์</description>
	<lastBuildDate>Sat, 12 May 2012 10:38:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>เพิ่ม แก้ไข ลบ ผู้ใช้งานบนลีนุกซ์</title>
		<link>http://spalinux.com/2012/04/add-modify-delete-user-on-linux</link>
		<comments>http://spalinux.com/2012/04/add-modify-delete-user-on-linux#comments</comments>
		<pubDate>Sat, 21 Apr 2012 06:21:58 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[CentOS 6]]></category>
		<category><![CDATA[Linux Installation]]></category>
		<category><![CDATA[Linux Shell]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Users]]></category>
		<category><![CDATA[add]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[modify]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=2126</guid>
		<description><![CDATA[เนื่องจาก root สามารถทำได้ทุกอย่างบนลีนุกซ์ ไม่ว่าจะติดตั้งโปรแกรม แก้ไขคอนฟิก หรือกระทั่งสั่งปิดเครื่อง (shutdown) คำแนะนำอย่างหนึ่งสำหรับผู้ใช้ลีนุกซ์ ไม่ว่าจะเพิ่งเริ่มต้นหัดใช้งาน หรือใช้งานมานานแล้ว คือล็อกอินเป็นผู้ใช้ธรรมดาที่ไม่ใช่ root ให้เป็นนิสัย เพราะผู้ใช้งานธรรมดา ก็สามารถทำอะไรได้หลายอย่างแล้ว เช่นดูคอนฟิกของเครื่อง แก้ไขไฟล์เท่าที่มีสิทธิ์ และหากทำอะไรผิดพลาดไป ความเสียหายที่เกิดขึ้น ก็จะกระทบในระดับหนึ่ง เท่าที่ผู้ใช้คนนั้นจะทำได้ ไม่กระทบทั้งเครื่อง จนกว่าจำเป็นต้องมีการแก้ไขคอนฟิกหรือทำอะไรบางอย่างกับลีนุกซ์ที่จำเป็นต้องทำด้วย root ค่อยใช้คำสั่ง su เปลี่ยนผู้ใช้ root (หรือใช้ sudo) และเมื่อหลังจากแก้ไขเสร็จสิ้นแล้ว ก็เปลี่ยนกลับมาเป็น user ธรรมดาอีกครั้ง ในบทนี้จะอธิบายคำสั่งที่ใช้ในการ เพิ่ม แก้ไข ลบ ผู้ใช้งาน โดยต้องใช้ root เป็นคนรันคำสั่ง การเพิ่มผู้ใช้งาน (useradd) ใช้คำสั่ง useradd ตามด้วยชื่อ user ที่ต้องการเพิ่ม เช่นต้องการเพิ่มผู้ใช้งานชื่อ alice [root@cent6 ~]# useradd alice [...]]]></description>
			<content:encoded><![CDATA[<p>เนื่องจาก root สามารถทำได้ทุกอย่างบนลีนุกซ์ ไม่ว่าจะติดตั้งโปรแกรม แก้ไขคอนฟิก หรือกระทั่งสั่งปิดเครื่อง (shutdown)</p>
<p>คำแนะนำอย่างหนึ่งสำหรับผู้ใช้ลีนุกซ์ ไม่ว่าจะเพิ่งเริ่มต้นหัดใช้งาน หรือใช้งานมานานแล้ว คือล็อกอินเป็นผู้ใช้ธรรมดาที่ไม่ใช่ root ให้เป็นนิสัย เพราะผู้ใช้งานธรรมดา ก็สามารถทำอะไรได้หลายอย่างแล้ว เช่นดูคอนฟิกของเครื่อง แก้ไขไฟล์เท่าที่มีสิทธิ์ และหากทำอะไรผิดพลาดไป ความเสียหายที่เกิดขึ้น ก็จะกระทบในระดับหนึ่ง เท่าที่ผู้ใช้คนนั้นจะทำได้ ไม่กระทบทั้งเครื่อง</p>
<p>จนกว่าจำเป็นต้องมีการแก้ไขคอนฟิกหรือทำอะไรบางอย่างกับลีนุกซ์ที่จำเป็นต้องทำด้วย root ค่อยใช้คำสั่ง su เปลี่ยนผู้ใช้ root (หรือใช้ sudo) และเมื่อหลังจากแก้ไขเสร็จสิ้นแล้ว ก็เปลี่ยนกลับมาเป็น user ธรรมดาอีกครั้ง</p>
<p>ในบทนี้จะอธิบายคำสั่งที่ใช้ในการ เพิ่ม แก้ไข ลบ ผู้ใช้งาน โดยต้องใช้ root เป็นคนรันคำสั่ง</p>
<h4><span id="more-2126"></span><br />
การเพิ่มผู้ใช้งาน (useradd)</h4>
<p>ใช้คำสั่ง useradd ตามด้วยชื่อ user ที่ต้องการเพิ่ม เช่นต้องการเพิ่มผู้ใช้งานชื่อ alice</p>
<pre>[root@cent6 ~]# <strong>useradd alice</strong></pre>
<p>คำสั่ง id ตามด้วยชื่อผู้ใช้งาน สามารถใช้ตรวจสอบข้อมูลของผู้ใช้ได้ เช่น uid, gid ของผู้ใช้</p>
<pre>[root@cent6 ~]# <strong>id alice</strong>
uid=500(alice) gid=500(alice) groups=500(alice)</pre>
<p>หากพิมพ์คำสั่ง id เฉยๆ จะเป็นการดูข้อมูลของตัวเอง เช่นถ้า root พิมพ์คำสั่ง id ไม่ได้ระบุชื่อผู้ใช้ ผลลัพธ์จะแสดงข้อมูลของ root</p>
<pre>[root@cent6 ~]# <strong>id</strong>
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023</pre>
<h4>เปลี่ยนรหัสผ่านผู้ใช้งาน (passwd)</h4>
<p>ใช้คำสั่ง passwd ตามด้วยชื่อผู้ใช้งาน เพื่อเปลี่ยนรหัสผ่านของผู้ใช้งาน พิมพ์ password สองครั้งให้เหมือนกัน หน้าจอจะไม่แสดงรหัสผ่านที่พิมพ์ลงไป</p>
<pre>[root@cent6 ~]# <strong>passwd alice</strong>
Changing password for user <span style="color: #0000ff;">alice</span>.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.</pre>
<p>ระวังการใช้คำสั่ง passwd ด้วย root เพราะถ้าลืมพิมพ์ชื่อผู้ใช้งานตามหลังคำสั่ง passwd จะเป็นการเปลี่ยนรหัสผ่านของตัวเอง เช่นถ้า root พิมพ์ ก็จะเป็นการเปลี่ยนรหัสผ่านของ root เอง</p>
<pre>[root@cent6 ~]# <strong>passwd</strong>
Changing password for user <span style="color: #0000ff;">root</span>.
New password:</pre>
<p>สังเกตชื่อ user ที่แสดงขึ้นมาหลังประโยค Changing password for user</p>
<p>หากต้องการยกเลิกการรันคำสั่ง passwd (และหลายๆ คำสั่งบนลีนุกซ์) ให้กดปุ่ม [Ctrl]+[C] จะเป็นการยกเลิก และออกจากคำสั่งได้</p>
<pre>[root@cent6 ~]# <strong>passwd</strong>
Changing password for user <span style="color: #0000ff;">root</span>.
New password: <span style="color: #ff0000;"><strong>[Ctrl]+[C]</strong></span>
[root@cent6 ~]#</pre>
<p>&nbsp;</p>
<p>คำสั่ง passwd จะมีการตรวจสอบความยากง่าย (ต่อการเดา) ของรหัสผ่านที่จะเปลี่ยน คือถ้าสามารถเดาง่ายเกินไป หน้าจอจะแสดงคำเตือนว่า BAD PASSWORD พร้อมคำอธิบายประกอบ เช่นสั้นเกินไป ง่ายต่อการเดา หรือเป็นคำที่อยู่ใน dictionary</p>
<p>เพื่อความปลอดภัยของระบบ แนะนำให้ตั้งรหัสผ่านที่ยากต่อการเดา แต่ให้ผู้ใช้งานเองจำได้ด้วย</p>
<pre>[root@cent6 ~]# <strong>passwd alice</strong>
Changing password for user alice.
New password:
<span style="color: #ff0000;">BAD PASSWORD: it is too short</span>
<span style="color: #ff0000;">BAD PASSWORD: is too simple</span>
Retype new password:</pre>
<p>ถ้ายังยืนยันจะใช้ root ก็สามารถเปลี่ยนรหัสผ่านให้ได้ (ไม่แนะนำ)</p>
<p>ผู้ใช้งานแต่ละคนสามารถเปลี่ยนรหัสผ่านของตัวเองได้ โดยใช้คำสั่ง passwd</p>
<p>ข้อแตกต่างหากรันคำสั่ง passwd ด้วยตัวผู้ใช้งานเองคือ</p>
<ul>
<li>ต้องใส่รหัสผ่านที่ใช้งานอยู่ (current) ให้ถูกต้อง</li>
<li>จะไม่ยอมให้ผู้ใช้งานเอง ตั้งรหัสผ่านง่ายเกินไป</li>
</ul>
<p>ตัวอย่างการใส่รหัสผ่านที่ใช้งานอยู่ไม่ถูกต้อง</p>
<pre>[alice@cent6 ~]$ <strong>passwd</strong>
Changing password for user alice.
Changing password for alice.
(current) UNIX password:
<span style="color: #ff0000;">passwd: Authentication token manipulation error</span></pre>
<p>ตัวอย่างการตั้งรหัสผ่านง่ายเกินไป คำสั่ง passwd จะไม่ยอมเปลี่ยนให้</p>
<pre>[alice@cent6 ~]$ <strong>passwd</strong>
Changing password for user alice.
Changing password for alice.
(current) UNIX password:
New password:
<span style="color: #ff0000;">BAD PASSWORD: it is too short</span>
New password:
<span style="color: #ff0000;">BAD PASSWORD: it is based on your username</span>
New password:
<span style="color: #ff0000;">BAD PASSWORD: it is based on a dictionary word</span>
passwd: Have exhausted maximum number of retries for service
[alice@cent6 ~]$</pre>
<p>&nbsp;</p>
<h4>เปลี่ยนเป็น root ด้วยคำสั่ง su</h4>
<p>ตัวอย่างการล็อกอินด้วยผู้ใช้งานธรรมดา สังเกต พร้อมพต์จะเป็นเครื่องหมาย $</p>
<pre>login as: <strong>alice</strong>
alice@192.168.5.62's password:
[alice@cent6 ~]$</pre>
<p>ใช้คำสั่ง su เมื่อต้องการเปลี่ยนจากผู้ใช้งานธรรมดา ให้เป็น root ใส่ password ของ root ให้ถูกต้อง</p>
<p>สังเกต พร้อมพต์ที่เปลี่ยนไปจากเครื่องหมาย $ เป็น #</p>
<pre>[alice@cent6 ~]$ <strong>su -</strong>
Password:
[root@cent6 ~]#</pre>
<p>ใช้คำสั่ง exit เมื่อต้องการออกจาก root เปลี่ยนเป็นผู้ใช้ธรรมดา</p>
<pre>[root@cent6 alice]# <strong>exit</strong>
exit
[alice@cent6 ~]$</pre>
<p>การใช้คำสั่ง su เพื่อเปลี่ยนเป็น root แนะนำให้พิมพ์เว้นวรรคแล้วตามด้วยเครื่องหมายลบ &#8220;-&#8221; เพื่อเปลี่ยนเป็น root แบบสมบูรณ์แบบ คือให้อ่านค่าคอนฟิกของ root  ด้วย</p>
<p>ตัวอย่างที่เห็นได้ชัดคือค่าคอนฟิก PATH ระหว่างผู้ใช้ธรรมดา กับ root จะแตกต่างกัน หากเปรียบเทียบการใช้คำสั่ง su แล้วตามด้วยเครื่องหมายลบ</p>
<pre>[alice@cent6 ~]$ <strong>echo $PATH</strong>
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/alice/bin</pre>
<p>คำสั่ง su แบบไม่มีเครื่องหมายลบ ตัวแปร $PATH จะมีค่าเหมือนเดิม</p>
<pre>[alice@cent6 ~]$ <strong>su</strong>
Password:
[root@cent6 alice]# echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/alice/bin</pre>
<p>&nbsp;</p>
<p>คำสั่ง su ตามด้วยเครื่องหมาย &#8216;-&#8217; ตัวแปร $PATH จะเปลี่ยนไปตามคอนฟิกของ root</p>
<pre>[alice@cent6 ~]$ <strong>su -</strong>
Password:
[root@cent6 ~]# <strong>echo $PATH</strong>
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin</pre>
<p>&nbsp;</p>
<h4>การลบผู้ใช้งาน (userdel)</h4>
<p>ใช้คำสั่ง userdel ตามด้วยชื่อผู้ใช้งานที่ต้องการลบออกจากเครื่องลีนุกซ์</p>
<p>โดยดีฟอลต์ คำสั่ง userdel จะลบชื่อผู้ใช้ออกจากระบบ แต่ไฟล์ที่อยู่ใน HOME ของผู้ใช้ยังอยู่ ทั้งนี้ก็เพื่อสำรองไฟล์ไว้ เผื่อผู้ใช้งานคนนี้จะมาขอไฟล์ภายหลังได้</p>
<p>ตัวอย่างการใช้คำสั่ง userdel ไม่ระบุออปชั่น</p>
<pre>[root@cent6 ~]# <strong>id alice</strong>
uid=500(alice) gid=500(alice) groups=500(alice)

[root@cent6 ~]# <strong>userdel alice</strong>

[root@cent6 ~]# <strong>ls -ld /home/alice/</strong>
drwx------. 2 500 500 4096 Apr 21 12:44 /home/alice/

[root@cent6 ~]# <strong>id alice</strong>
id: alice: No such user</pre>
<p>&nbsp;</p>
<p>ระบุออปชั่น &#8216;-r&#8217; หากต้องการลบไฟล์ที่อยู่ใน HOME ของผู้ใช้ด้วย</p>
<pre>[root@cent6 ~]# <strong>id alice</strong>
uid=500(alice) gid=500(alice) groups=500(alice)

[root@cent6 ~]# <strong>userdel -r alice</strong>

[root@cent6 ~]# <strong>ls -ld /home/alice/</strong>
ls: cannot access /home/alice/: No such file or directory</pre>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2012/04/add-modify-delete-user-on-linux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>

