某些情况下,Ubuntu 使用useradd 新用户名,在home 文件夹下面看不到新创建的用户文件夹,例如:
[email protected]:/home/kuku# useradd spark
[email protected]:/home/kuku# passwd spark
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
[email protected]:/home/kuku# cd ..
[email protected]:/home# ls
kuku
[email protected]:/home#
发现找不到,spark的文件夹,因此将采用下面方式重新建立
首先删除spark用户
[email protected]:/home# userdel spark
[email protected]:/home# useradd -r -m -s /bin/bash spark
[email protected]:/home# passwd spark
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
[email protected]:/home# ls
kuku spark
[email protected]:/home#
若想给新用户添加root权限,则
[email protected]:/home#chmod +w /etc/sudoers
[email protected]:/home# vim /etc/sudoers
添加
保存即可!
若想删除某个用户,则
[email protected]:/home# userdel -r spark
userdel: spark mail spool (/var/mail/spark) not found
[email protected]:/home# ls
kuku
[email protected]:/home#
原文地址:https://www.cnblogs.com/jiu0821/p/9531806.html