尊龙凯时人生就是搏

ÔõÑùÉèÖÃCentOSϵͳÒÔÏÞÖÆÓû§¶Ôϵͳ×ÊÔ´µÄ»á¼ûȨÏÞ

ÔõÑùÉèÖÃcentosϵͳÒÔÏÞÖÆÓû§¶Ôϵͳ×ÊÔ´µÄ»á¼ûȨÏÞ

СÐò£º

ÔÚÒ»¸ö¶àÓû§µÄϵͳÖУ¬ÎªÁ˱£»¤ÏµÍ³µÄÎȹÌÐÔºÍÇå¾²ÐÔ£¬ÐèÒª¶ÔÓû§µÄ»á¼ûȨÏÞ¾ÙÐÐÏÞÖÆ¡£CentOSÊÇÒ»ÖÖÊ¢ÐеÄLinux²Ù×÷ϵͳ£¬±¾ÎĽ«ÏÈÈÝÔõÑùÔÚCentOSϵͳÉÏÉèÖÃÓû§µÄ»á¼ûȨÏÞ£¬ÒÔʵÏÖ¶Ôϵͳ×ÊÔ´µÄÏÞÖÆ¡£

Ò»¡¢Óû§ºÍÓû§×éÖÎÀí

CentOSϵͳʹÓÃ/etc/passwdºÍ/etc/groupÎļþÀ´ÖÎÀíÓû§ºÍÓû§×é¡£ÎÒÃÇ¿ÉÒÔʹÓÃuseraddÏÂÁîÀ´½¨ÉèÐÂÓû§£¬Ê¹ÓÃgroupaddÏÂÁîÀ´½¨ÉèÐÂÓû§×é¡£

ʾÀý1£º½¨ÉèÐÂÓû§

sudo useradd -m -G users,testuser    # ½¨ÉèÒ»¸öÃûΪtestuserµÄÓû§£¬²¢½«ÆäÌí¼Óµ½usersºÍtestuserÁ½¸öÓû§×éÖÐ

µÇ¼ºó¸´ÖÆ

¶þ¡¢Óû§È¨ÏÞÖÎÀí

ÔÚCentOSϵͳÖУ¬Óû§µÄȨÏÞÐÅÏ¢±»´æ´¢ÔÚ/etc/sudoersÎļþÖС£ÎÒÃÇ¿ÉÒÔͨ¹ýÐ޸ĸÃÎļþÀ´ÉèÖÃÓû§µÄsudoȨÏÞ¡£

ʾÀý2£ºÉèÖÃÓû§sudoȨÏÞ

sudo visudo     # ʹÓÃvisudoÏÂÁîÀ´±à¼­sudoersÎļþ

µÇ¼ºó¸´ÖÆ

ÔÚÎļþÖÐÕÒµ½²¢ÐÞ¸ÄÒÔÏÂÐУº

## Allow root to run any commands anywhere
root    ALL=(ALL)    ALL

## Allow members of group sudo to execute any command
# %sudo ALL=(ALL) ALL

## Allow members of group sudo to execute any command as any user
%sudo   ALL=(ALL:ALL) ALL

µÇ¼ºó¸´ÖÆ

ʾÀý3£ºÏÞÖÆÓû§sudoȨÏÞ

ÈôÊÇÎÒÃÇÏ£ÍûÏÞÖÆÓû§Ö»ÄÜÖ´ÐÐÌض¨µÄÏÂÁ¿ÉÒÔÌí¼ÓÏìÓ¦µÄȨÏÞÉèÖã¬ÈçÏÂËùʾ£º

user1   ALL=(ALL)    /usr/bin/ls, /usr/bin/cat    # Óû§user1¿ÉÒÔÖ´ÐÐlsºÍcatÏÂÁî
user2   ALL=(ALL)    NOPASSWD: /sbin/reboot       # Óû§user2¿ÉÒÔÖ´ÐÐrebootÏÂÁÎÞÐèÃÜÂëÑéÖ¤

µÇ¼ºó¸´ÖÆ

Èý¡¢ÎļþȨÏÞÖÎÀí

CentOSϵͳʹÓÃȨÏÞλÀ´ÖÎÀíÎļþµÄ¶Á¡¢Ð´ºÍÖ´ÐÐȨÏÞ¡£ÎÒÃÇ¿ÉÒÔʹÓÃchmodÏÂÁîÀ´¸ü¸ÄÎļþµÄȨÏÞ¡£

ʾÀý4£º¸ü¸ÄÎļþËùÓÐÕߺÍȨÏÞ

sudo chown user1:group1 file.txt    # ½«Îļþfile.txtµÄËùÓÐÕßÉèÖÃΪuser1£¬Óû§×éÉèÖÃΪgroup1
sudo chmod 600 file.txt             # ÉèÖÃÎļþfile.txtµÄȨÏÞΪ600£¬¼´Ö»ÓÐËùÓÐÕßÓжÁдȨÏÞ

µÇ¼ºó¸´ÖÆ

ʾÀý5£ºÉèÖÃÎļþµÄ»á¼û¿ØÖÆÁÐ±í£¨ACL£©

»á¼û¿ØÖÆÁÐ±í£¨ACL£©ÔÊÐíÎÒÃÇΪÎļþºÍĿ¼ÉèÖÃϸÁ£¶ÈµÄ»á¼û¿ØÖÆ¡£ÎÒÃÇ¿ÉÒÔʹÓÃsetfaclÏÂÁîÀ´ÉèÖÃÎļþµÄACL¡£

Ê×ÏÈ£¬ÎÒÃÇÐèҪȷ±£Îļþϵͳ֧³ÖACL¡£ÎÒÃÇ¿ÉÒÔÔÚ/etc/fstabÎļþÖÐÕÒµ½ÏìÓ¦µÄÎļþϵͳÌõÄ¿£¬²¢È·±£aclÑ¡Ïî±»ÆôÓá£ÀýÈ磺

UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx / ext4 defaults,acl 0 0

µÇ¼ºó¸´ÖÆ

½ÓÏÂÀ´£¬ÎÒÃÇ¿ÉÒÔʹÓÃsetfaclÏÂÁîÀ´ÉèÖÃÎļþµÄACL£¬ÈçÏÂËùʾ£º

sudo setfacl -m u:user1:rw file.txt        # ¸øuser1ÊÚÓèfile.txtµÄ¶ÁдȨÏÞ
sudo setfacl -m u:user2:r file.txt         # ¸øuser2ÊÚÓèfile.txtµÄ¶ÁȨÏÞ
sudo getfacl file.txt                      # Éó²éÎļþfile.txtµÄACLÉèÖÃ

µÇ¼ºó¸´ÖÆ

½áÂÛ£º

ͨ¹ýÊÊÍâµØÉèÖÃCentOSϵͳ£¬ÎÒÃÇ¿ÉÒÔÏÞÖÆÓû§¶Ôϵͳ×ÊÔ´µÄ»á¼ûȨÏÞ£¬±£»¤ÏµÍ³µÄÎȹÌÐÔºÍÇå¾²ÐÔ¡£±¾ÎÄÏÈÈÝÁËÓû§ºÍÓû§×éÖÎÀí¡¢Óû§È¨ÏÞÖÎÀíºÍÎļþȨÏÞÖÎÀíµÄ³£ÓÃÒªÁ죬²¢ÌṩÁËÏìÓ¦µÄ´úÂëʾÀý¡£Ï£Íû±¾ÎÄ¿ÉÒÔ×ÊÖú¶ÁÕ߸üºÃµØÉèÖÃCentOSϵͳ£¬²¢ÊµÏÖ¶Ôϵͳ×ÊÔ´µÄÓÐÓÃÖÎÀí¡£

ÒÔÉϾÍÊÇÔõÑùÉèÖÃCentOSϵͳÒÔÏÞÖÆÓû§¶Ôϵͳ×ÊÔ´µÄ»á¼ûȨÏÞµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ