<!DOCTYPE html>
    <html lang="vi" xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns#">
    <head>
<title>File &#x002F;etc&#x002F;passwd là gì? File &#x002F;etc&#x002F;passwd được sử dụng để làm gì?</title>
<meta name="description" content="File &#x002F;etc&#x002F;passwd là gì? File &#x002F;etc&#x002F;passwd được sử dụng để làm gì? - Savefile - Tin Tức -...">
<meta name="author" content=".: Nguoicodonvn2008.info - Cõi lòng người cô đơn :.">
<meta name="copyright" content=".: Nguoicodonvn2008.info - Cõi lòng người cô đơn :. [admin@nguoicodonvn2008.info]">
<meta name="robots" content="index, archive, follow, noodp">
<meta name="googlebot" content="index,archive,follow,noodp">
<meta name="msnbot" content="all,index,follow">
<meta name="generator" content="NukeViet v4.5">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta property="og:title" content="File &#x002F;etc&#x002F;passwd là gì? File &#x002F;etc&#x002F;passwd được sử dụng để làm gì?">
<meta property="og:type" content="website">
<meta property="og:description" content="Savefile - Tin Tức - https&#x3A;&#x002F;&#x002F;www.nguoicodonvn2008.info&#x002F;vi&#x002F;news&#x002F;savefile&#x002F;kien-thuc-may-tinh&#x002F;file-etc-passwd-la-gi-file-etc-passwd-duoc-su-dung-de-lam-gi-4087.html">
<meta property="og:site_name" content=".&#x3A; Nguoicodonvn2008.info - Cõi lòng người cô đơn &#x3A;.">
<meta property="og:url" content="https://www.nguoicodonvn2008.info/vi/news/savefile/kien-thuc-may-tinh/file-etc-passwd-la-gi-file-etc-passwd-duoc-su-dung-de-lam-gi-4087.html">
<link rel="shortcut icon" href="https://www.nguoicodonvn2008.info/favicon.ico">
<link rel="canonical" href="https://www.nguoicodonvn2008.info/vi/news/savefile/kien-thuc-may-tinh/file-etc-passwd-la-gi-file-etc-passwd-duoc-su-dung-de-lam-gi-4087.html">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/" title="Tin Tức" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/karaoke-dual/" title="Tin Tức - Karaoke Dual" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/nhac-tre/" title="Tin Tức - Nhạc trẻ" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/tru-tinh/" title="Tin Tức - Trữ tình" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/nuoc-ngoai/" title="Tin Tức - Nước ngoài" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/remix/" title="Tin Tức - Remix" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/tam-su-tinh-yeu/" title="Tin Tức - Tâm sự tình yêu" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/tho-suu-tam/" title="Tin Tức - Thơ sưu tầm" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/cuoc-song/" title="Tin Tức - Cuộc sống" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/phan-mem/" title="Tin Tức - Phần mềm" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/kien-thuc-may-tinh/" title="Tin Tức - Kiến thức máy tính" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/hoc-tap/" title="Tin Tức - Học tập" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/tai-lieu/" title="Tin Tức - Tài liệu" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/de-thi/" title="Tin Tức - Đề thi" type="application/rss+xml">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/assets/css/font-awesome.min.css" type="text/css">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/themes/default/css/bootstrap.non-responsive.css" type="text/css">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/themes/default/css/style.css" type="text/css">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/themes/default/css/style.non-responsive.css" type="text/css">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/themes/default/css/news.css" type="text/css">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/themes/default/css/custom.css" type="text/css">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/assets/js/jquery/jquery.min.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/assets/js/language/vi.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/assets/js/DOMPurify/purify3.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/assets/js/global.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/assets/js/site.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/themes/default/js/news.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/themes/default/js/main.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/themes/default/js/custom.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/themes/default/js/bootstrap.min.js" type="text/javascript">
<link rel="stylesheet" href="https://www.nguoicodonvn2008.info/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="https://www.nguoicodonvn2008.info/themes/default/css/bootstrap.non-responsive.css">
<link rel="stylesheet" href="https://www.nguoicodonvn2008.info/themes/default/css/style.css">
<link rel="stylesheet" href="https://www.nguoicodonvn2008.info/themes/default/css/style.non-responsive.css">
<link rel="StyleSheet" href="https://www.nguoicodonvn2008.info/themes/default/css/news.css">
<link rel="stylesheet" href="https://www.nguoicodonvn2008.info/themes/default/css/custom.css">
<style type="text/css">
	body{background: #fff;}
</style>
    </head>
    <body>
<div id="print">
	<div id="hd_print">
		<h2 class="pull-left">.&#x3A; Nguoicodonvn2008.info - Cõi lòng người cô đơn &#x3A;.</h2>
		<p class="pull-right"><a title=".&#x3A; Nguoicodonvn2008.info - Cõi lòng người cô đơn &#x3A;." href="https://www.nguoicodonvn2008.info/">https://www.nguoicodonvn2008.info</a></p>
	</div>
	<div class="clear"></div>
	<hr />
	<div id="content">
		<h1>File &#x002F;etc&#x002F;passwd là gì? File &#x002F;etc&#x002F;passwd được sử dụng để làm gì?</h1>
		<ul class="list-inline">
			<li>Thứ hai - 17/05/2021 00:52</li>
			<li class="hidden-print txtrequired"><em class="fa fa-print">&nbsp;</em><a title="In ra" href="javascript:;" onclick="window.print()">In ra</a></li>
			<li class="hidden-print txtrequired"><em class="fa fa-power-off">&nbsp;</em><a title="Đóng cửa sổ này" href="javascript:;" onclick="window.close()">Đóng cửa sổ này</a></li>
		</ul>
		<div class="clear"></div>
		<div id="hometext">
		</div>
				<div class="imghome">
			<img alt="File &#x002F;etc&#x002F;passwd là gì? File &#x002F;etc&#x002F;passwd được sử dụng để làm gì?" src="https://st.quantrimang.com/photos/image/2021/05/17/file-etc-passwd-1.jpg" width="460" class="img-thumbnail" />
		</div>
		<div class="clear"></div>
		<div id="bodytext" class="clearfix">
			<p style="text-align: justify;">Linux&nbsp;là một hệ điều hành đa người dùng. Và để tạo điều kiện quản lý người dùng thích hợp, hệ thống lưu trữ thông tin người dùng trong file&nbsp;<strong>/etc/passwd.</strong></p>

<p style="text-align: justify;">Hướng dẫn này sẽ giúp bạn hiểu file passwd là gì và vai trò quan trọng của file này khi quản lý người dùng trong Linux.</p>

<h2 style="text-align: justify;">File /etc/passwd là gì?</h2>

<p style="text-align: justify;">File passwd trong Linux là file cấu hình chứa thông tin chi tiết về người dùng. Một đặc điểm quan trọng của file passwd là nó là file văn bản ASCII mà người dùng có thể chỉnh sửa dễ dàng bằng bất kỳ trình soạn thảo văn bản nào như&nbsp;Nano và Vim.</p>

<p style="text-align: justify;">Mặc dù bạn có thể thêm và quản lý người dùng trực tiếp bằng cách sử dụng file passwd, nhưng không nên thực hiện điều đó vì hành động này dễ mắc lỗi chính tả và gây ra sự cố. Thay vào đó, bạn nên sử dụng các lệnh quản lý người dùng khác nhau như&nbsp;<strong>useradd</strong>&nbsp;để thêm người dùng vào hệ thống của mình.</p>

<h2 style="text-align: justify;">Xem file /etc/passwd</h2>

<p style="text-align: justify;">Để xem nội dung của file passwd, bạn có thể sử dụng bất kỳ trình soạn thảo văn bản nào hoặc công cụ lệnh xem file. Trong hướng dẫn này, bài viết sẽ&nbsp;sử dụng lệnh cat:</p>

<pre id="pre0">
<code>cat /etc/passwd</code></pre>

<p style="text-align: justify;">Đầu ra sẽ tương tự như bên dưới.</p>

<figure>
<div style="text-align: justify;"><img alt="Nội dung file /etc/passwd" data-i="0" data-src="https://st.quantrimang.com/photos/image/2021/05/17/file-etc-passwd-1.jpg" data-was-processed="true" height="271" src="https://st.quantrimang.com/photos/image/2021/05/17/file-etc-passwd-1.jpg" width="650" /></div>

<figcaption>
<div style="text-align: justify;">Nội dung file /etc/passwd</div>
</figcaption>
</figure>

<p style="text-align: justify;">Mỗi dòng thực sự đại diện cho một user trên hệ thống của bạn, vì vậy đừng ngạc nhiên khi bạn có rất nhiều userđược liệt kê. Hầu hết họ là người dùng hệ thống kiểm soát các ứng dụng cụ thể trên máy Linux của bạn. Ví dụ, user&nbsp;<strong>mail</strong>&nbsp;chịu trách nhiệm cho ứng dụng&nbsp;<strong>Mail</strong>.</p>

<div style="text-align: justify;">&nbsp;</div>

<h2 style="text-align: justify;">Giải thích các trường trong file /etc/passwd</h2>

<p style="text-align: justify;">Từ kết quả đầu ra ở trên, rất rõ ràng rằng file /etc/passwd tuân theo một mẫu rất cụ thể.</p>

<p style="text-align: justify;">Mỗi dòng user được chia nhỏ hơn nữa thành 7 phần hoặc trường được phân tách bằng ký tự dấu hai chấm (:) như bên dưới.</p>

<figure>
<div style="text-align: justify;"><img alt="Các trường trong file /etc/passwd" data-i="1" data-src="https://st.quantrimang.com/photos/image/2021/05/17/file-etc-passwd-2.jpg" data-was-processed="true" height="255" src="https://st.quantrimang.com/photos/image/2021/05/17/file-etc-passwd-2.jpg" width="650" /></div>

<figcaption>
<div style="text-align: justify;">Các trường trong file /etc/passwd</div>
</figcaption>
</figure>

<h3 style="text-align: justify;">1. Username</h3>

<p style="text-align: justify;">Trường đầu tiên trong một dòng đại diện cho tên người dùng hoặc tên đăng nhập của người dùng. Trong ví dụ trên, tên người dùng là&nbsp;<strong>john.</strong></p>

<h3 style="text-align: justify;">2. Password</h3>

<p style="text-align: justify;">Trường thứ hai hiển thị mật khẩu được mã hóa của người dùng. Vì mục đích bảo mật, mật khẩu được giữ trong một file riêng biệt mà người dùng thông thường không thể đọc được. File /etc/shadow lưu trữ mật khẩu của người dùng trong Linux.</p>

<p style="text-align: justify;">Thông thường, trường mật khẩu chứa một dấu&nbsp;<strong>x</strong>&nbsp;để cho thấy rằng file shadow đang lưu trữ mật khẩu một cách bảo mật. Nếu trường trống thì người dùng không cần mật khẩu để đăng nhập. Để duy trì bảo mật hệ thống tổng thể, mọi người dùng trên hệ thống của bạn phải có mật khẩu. Bạn có thể sử dụng lệnh passwd để thay đổi hoặc quản lý mật khẩu người dùng trong Linux.</p>

<h3 style="text-align: justify;">3. User ID</h3>

<p style="text-align: justify;">Trường User ID, thường được gọi là UID, là một số được hệ thống Linux sử dụng để xác định người dùng. Hầu hết người dùng hệ thống có User ID ít hơn con số 1000 trong khi người dùng thông thường có ID từ 1000 trở lên.&nbsp;Người dùng root (admin)&nbsp;thường có ID là 0.</p>

<h3 style="text-align: justify;">4. Group ID</h3>

<p style="text-align: justify;">Trường thứ tư dành cho ID nhóm (thường được gọi là GID). Giống như ID người dùng, GID cũng là một số. ID nhóm xác định nhóm chính của một người dùng. Ngoài ra, GID phân loại tất cả người dùng trong các nhóm cụ thể để việc quản trị dễ dàng hơn. Một người dùng có thể thuộc nhiều nhóm trong Linux. Để tìm hiểu thêm về nhóm người dùng thuộc về bạn, bạn có thể xem file /etc/group.</p>

<pre id="pre1">
<code>cat /etc/group</code></pre>

<h3 style="text-align: justify;">5. GECOS</h3>

<p style="text-align: justify;">Trường tiếp theo là trường GECOS. Nó thường chứa tên đầy đủ của người dùng và các chi tiết bổ sung như số điện thoại hoặc số phòng, được phân tách bằng dấu phẩy. Trường này là tùy chọn và do đó có thể để trống.</p>

<h3 style="text-align: justify;">6. Home Directory</h3>

<p style="text-align: justify;">Trường này chứa thư mục&nbsp;<strong>/home</strong>&nbsp;được liên kết với người dùng. Đây là thư mục chính lưu trữ các file người dùng chính và các thư mục như&nbsp;<strong>/Desktop</strong>&nbsp;và&nbsp;<strong>/Pictures.</strong>&nbsp;Trong ví dụ này, thư mục chính của người dùng là&nbsp;<strong>/home/john.</strong></p>

<p style="text-align: justify;">Có các thư mục home riêng biệt cho mỗi user là một trong những yếu tố cho phép Linux trở thành một hệ điều hành đa người dùng thực sự.</p>

<h3 style="text-align: justify;">7. Shell</h3>

<p style="text-align: justify;">Trường này chứa tên của shell mặc định được liên kết với người dùng. Shell là môi trường mà người dùng có thể chạy các lệnh và script. Hầu hết các bản phân phối Linux sử dụng Bourne Again Shell (Bash) làm chương trình shell mặc định.</p>
		</div>
				<div id="author">
						<p>
				<strong>Nguồn tin:</strong>
				Quantrimang.com
			</p>
		</div>
	</div>
	<div id="footer" class="clearfix">
		<div id="url">
			<strong>URL của bản tin này: </strong><a href="https://www.nguoicodonvn2008.info/vi/news/savefile/kien-thuc-may-tinh/file-etc-passwd-la-gi-file-etc-passwd-duoc-su-dung-de-lam-gi-4087.html" title="File &#x002F;etc&#x002F;passwd là gì? File &#x002F;etc&#x002F;passwd được sử dụng để làm gì?">https://www.nguoicodonvn2008.info/vi/news/savefile/kien-thuc-may-tinh/file-etc-passwd-la-gi-file-etc-passwd-duoc-su-dung-de-lam-gi-4087.html</a>

		</div>
		<div class="clear"></div>
		<div class="copyright">
			&copy; .&#x3A; Nguoicodonvn2008.info - Cõi lòng người cô đơn &#x3A;.
		</div>
		<div id="contact">
			<a href="mailto:admin@nguoicodonvn2008.info">admin@nguoicodonvn2008.info</a>
		</div>
	</div>
</div>
        <div id="timeoutsess" class="chromeframe">
            Bạn đã không sử dụng Site, <a onclick="timeoutsesscancel();" href="https://www.nguoicodonvn2008.info/#">Bấm vào đây để duy trì trạng thái đăng nhập</a>. Thời gian chờ: <span id="secField"> 60 </span> giây
        </div>
        <div id="openidResult" class="nv-alert" style="display:none"></div>
        <div id="openidBt" data-result="" data-redirect=""></div>
		</script>
		<div class="car-top">
  <span><img src="https://www.nguoicodonvn2008.info/themes/default/images/car.png" alt=""></span>
</div>
<script src="https://www.nguoicodonvn2008.info/assets/js/jquery/jquery.min.js"></script>
<script>var nv_base_siteurl="/",nv_lang_data="vi",nv_lang_interface="vi",nv_name_variable="nv",nv_fc_variable="op",nv_lang_variable="language",nv_module_name="news",nv_func_name="savefile",nv_is_user=0, nv_my_ofs=-4,nv_my_abbr="EDT",nv_cookie_prefix="nv4c_e856T",nv_check_pass_mstime=1738000,nv_area_admin=0,nv_safemode=0,theme_responsive=0,nv_recaptcha_ver=2,nv_recaptcha_sitekey="",nv_recaptcha_type="image",XSSsanitize=1;</script>
<script src="https://www.nguoicodonvn2008.info/assets/js/language/vi.js"></script>
<script src="https://www.nguoicodonvn2008.info/assets/js/DOMPurify/purify3.js"></script>
<script src="https://www.nguoicodonvn2008.info/assets/js/global.js"></script>
<script src="https://www.nguoicodonvn2008.info/assets/js/site.js"></script>
<script src="https://www.nguoicodonvn2008.info/themes/default/js/news.js"></script>
<script src="https://www.nguoicodonvn2008.info/themes/default/js/main.js"></script>
<script src="https://www.nguoicodonvn2008.info/themes/default/js/custom.js"></script>
<script type="application/ld+json">
        {
            "@context": "https://schema.org",
            "@type": "Organization",
            "url": "https://www.nguoicodonvn2008.info",
            "logo": "https://www.nguoicodonvn2008.info/uploads/angel.gif"
        }
        </script>
<script src="https://www.nguoicodonvn2008.info/themes/default/js/bootstrap.min.js"></script>
<script type="text/javascript">
var $scrolltop = $('.car-top');
$scrolltop.on('click', function () {
    $('html,body').animate({
        scrollTop: 0
    }, 800);
    $(this).addClass("car-run");
    setTimeout(function(){ $scrolltop.removeClass('car-run');}, 1000);
    return false;
});
$(window).on('scroll', function ()
{ 
    if($(window).scrollTop() >= 200)
    {
        $scrolltop.addClass("show");
        $scrolltop.addClass("car-down");
    }
    else
    {
       $scrolltop.removeClass("show");
       setTimeout(function(){ $scrolltop.removeClass('car-down');}, 300);
    }
});
</script>
</body>
</html>