ubuntu中useradd和adduser究竟怎么用—用户管理一
来源:互联网 发布:unity3d培训机构那个好 编辑:程序博客网 时间:2024/05/21 22:32
在使用ubuntu的时候,稍微懂得点常识的童鞋都知道需要另创建一个用户方便自己以后操作,而不是直接使用超级用户root执行操作。不少人当然包括walfred在内创建新用户的时候基本上会先使用useradd命令。
可是useradd命令新手暂时还是不用的好,在ubuntu中创建新用户walfred推荐使用adduser命令:
walfred@ubuntu:~$ adduser newuser
adduser: Only root may add a user or group to the system.
walfred@ubuntu:~$ sudo adduser newuser
Adding user `newuser' ...
Adding new group `newuser' (1001) ...
Adding new user `newuser' (1001) with group `newuser' ...
Creating home directory `/home/newuser' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for newuser
Enter the new value, or press ENTER for the default
Full Name []: newuer
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] y
walfred@ubuntu:~$
使用adduser之后你享受到的将是一条龙服务,用户主目录自动生成以及密码、信息啥的都会依次提示你去完善,所以万无一失。但是高手却觉得很唐僧了,输入了这么多次,真麻烦,所以他们一般使用useradd命令,正确的使用useradd命令将会省去这么多的麻烦,一条语句就ok,所以说高手不一般的就在这边,哈哈,我会,但是我不是高手,not at all!
先看下参数:
walfred@ubuntu:~$ useradd -h
useradd: invalid option -- 'h'
Usage: useradd [options] LOGIN
Options:
-b, --base-dir BASE_DIR base directory for the home directory of the
new account
-c, --comment COMMENT GECOS field of the new account
-d, --home-dir HOME_DIR home directory of the new account
-D, --defaults print or change default useradd configuration
-e, --expiredate EXPIRE_DATE expiration date of the new account
-f, --inactive INACTIVE password inactivity period of the new account
-g, --gid GROUP name or ID of the primary group of the new
account
-G, --groups GROUPS list of supplementary groups of the new
account
-h, --help display this help message and exit
-k, --skel SKEL_DIR use this alternative skeleton directory
-K, --key KEY=VALUE override /etc/login.defs defaults
-l, --no-log-init do not add the user to the lastlog and
faillog databases
-m, --create-home create the user's home directory
-M, --no-create-home do not create the user's home directory
-N, --no-user-group do not create a group with the same name as
the user
-o, --non-unique allow to create users with duplicate
(non-unique) UID
-p, --password PASSWORD encrypted password of the new account
-r, --system create a system account
-s, --shell SHELL login shell of the new account
-u, --uid UID user ID of the new account
-U, --user-group create a group with the same name as the user
-Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
useradd是通用Linux发行版本的命令,所以这条命令才是王道:
walfred@ubuntu:~$ sudo useradd -m -N newuser
walfred@ubuntu:~$ passwd newuser
passwd: You may not view or modify password information for newuser.
walfred@ubuntu:~$ sudo passwd newuser
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
可是我暂时还不知道如何一次性创建密码,麻烦知者赐教!
返回嵌入式入门专辑目录
- ubuntu中useradd和adduser究竟怎么用—用户管理一
- Ubuntu中useradd和adduser的区别
- Ubuntu中useradd和adduser的区别
- Ubuntu中useradd和adduser的区别
- Ubuntu中,useradd和adduser的区别
- Ubuntu中,useradd和adduser的区别
- Ubuntu中useradd和adduser的区别
- Ubuntu中,useradd和adduser的区别
- Ubuntu 中useradd和adduser的区别
- Ubuntu中useradd和adduser的区别
- ubuntu 中useradd和adduser的区别
- ubuntu用户添加adduser, useradd
- ubuntu用户添加adduser, useradd
- ubuntu用户添加adduser, useradd
- ubuntu用户添加adduser, useradd
- Ubuntu中 useradd 和 adduser 是不相同的!
- linux用户管理(1)----创建用户(adduser和useradd)和删除用户(userdel)
- linux用户管理(1)----创建用户(adduser和useradd)和删除用户(userdel)
- u-boot移植(六)添加nandflash支持
- 如何在ASP.NET消息框中换行
- 用汇编的眼光看C++(开篇)
- deb包管理系统及实例讲解apt使用方法
- 如何将二维数组作为函数的参数传递
- ubuntu中useradd和adduser究竟怎么用—用户管理一
- u-boot移植(七)支持nand启动
- Notification详细用法
- ubuntu中添加了新用户的后续操作—用户管理二
- 搭建嵌入式Linux开发环境二
- Notification简介
- 设计模式之我见
- u-boot移植(八)支持yaffs
- 用汇编的眼光看C++ (之x86汇编)