26
2017
09

ubuntu服务器中新建用户及设置主目录

创建用户:

sanqi@sanqi:~$ sudo useradd sunsanqi

hpc@gpu-server:~$ sudo useradd sunsanqi
[sudo] password for hpc:

给用户加上密码:

sanqi@sanqi:~$ sudo passwd sunsanqi

hpc@gpu-server:~$ sudo passwd sunsanqi
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

为用户创建主目录:

sanqi@sanqi:~$ sudo mkdir /home/sunsanqi

hpc@gpu-server:/home$ sudo mkdir /home/sunsanqi

添加sunsanqi这个用户的主目录:

sanqi@sanqi:~$ sudo chown -Rv sunsanqi /home/sunsanqi/

hpc@gpu-server:/home$ sudo chown -Rv sunsanqi /home/sunsanqi/
changed ownership of ‘/home/sunsanqi/’ from root to sunsanqi

修改拥有者组为 sunsanqi

chgrp sunsanqi sunsanqi

上一篇:Android容器化/组件化方案 下一篇:Android开发中实用工具类总结