亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長(zhǎng)資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    如何在centos下創(chuàng)建新用戶名和密碼

    如何在centos下創(chuàng)建新用戶名和密碼

    如何在centos下創(chuàng)建新用戶名和密碼?

    一、創(chuàng)建新用戶

    1、創(chuàng)建一個(gè)新用戶:prefma

    [root@localhost ~]# adduser prefma

    2、為新用戶創(chuàng)建初始化密碼

    [root@localhost~]# passwd prefma Changing password for user prefma. New password:             # 輸入密碼 Retype new password:      # 再次輸入密碼 passwd: all authentication tokens updated successfully.

    二、授權(quán)

    個(gè)人用戶的權(quán)限只可以在本home下有完整權(quán)限,其他目錄需要?jiǎng)e人授權(quán)。經(jīng)常需要root用戶的權(quán)限,可以通過修改sudoers文件來賦予權(quán)限。

    新創(chuàng)建的用戶并不能使用sudo命令,需要給他添加授權(quán)。

    1、查找sudoers文件路徑并賦予權(quán)限

    1 [root@localhost~]# whereis sudoers                     # 查找sudoers文件路徑 2 sudoers: /etc/sudoers /etc/sudoers.d /usr/share/man/man5/sudoers.5.gz 3 [root@localhost~]# ls -l /etc/sudoers                  # 查看權(quán)限 4 -r--r----- 1 root root 3938 Sep  6  2017 /etc/sudoers  # 只有讀權(quán)限 5 [root@localhost~]# chmod -v u+w /etc/sudoers           # 賦予讀寫權(quán)限 6 mode of ‘/etc/sudoers’ changed from 0440 (r--r-----) to 0640 (rw-r-----)

    2、修改sudoers文件

    輸入命令 vim /etc/sudoers 修改sudoers文件,添加新用戶信息:

    ## Allow root to run any commands anywhere root ALL=(ALL) ALL prefma ALL=(ALL) ALL #這個(gè)是新用戶

    然后輸入命令 wq! 保存修改。

    3、收回權(quán)限

    [root@localhost~]# chmod -v u-w /etc/sudoers mode of ‘/etc/sudoers’ changed from 0640 (rw-r-----) to 0440 (r--r-----)

    4、新用戶登錄

    新建連接,使用新創(chuàng)建的用戶登錄,并進(jìn)行驗(yàn)證,比如:

    [prefma@localhost~]$ pwd /home/prefma [prefma@localhost~]$ ls -l /etc/sudoers -r--r----- 1 root root 3995 Oct 16 22:42 /etc/sudoers

    相關(guān)參考:centOS教程

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)