ubuntu 12.04useradd

ubuntu新建用户最好用adduser - IT男 - ITeye技术网站
博客分类:
ubuntu建用户最好用adduser,虽然adduser和useradd是一样的在别的linux糸统下,但是我在ubuntu下用useradd时,并没有创建同名的用户主目录。
例子:adduser user1
这样他就会自动创建用户主目录,创建用户同名的组。
如果删除了主目录,没有删除用户,可以用下面的命令,重建主目录
sudo mkdir /home/user&& #这里的/home/user里的user最好改成跟你原来用户名一样
sudo chown -R user:user /home/user& #这里的user:user要改成你之前的“用户名:用户组”的格式
sudo chmod -R 755 /home/user #这里权限给755
755是同组的还有别的组的用户可以查看并且可以执行的。如果不想同组的和别的组的用户查看,可以把权限设置为700
浏览: 755361 次
来自: 上海
没加 -b,是随机出多少个密码偿试。?
还有C1Calendar,也推荐试试
如何计算当天最大时间 有什么方法
很好很强打以上由提供
当前位置:
> 详细页面
如何辨别Ubuntu中useradd和adduser命令
时间: 14:58来源:作者:qipeng
系统教程栏目
热门系统教程
在笔记本电脑早已普及到会议室的这个年代,商务人士拿笔记...
热门系统下载
最新系统教程
热门软件下载
Copyright&2011 系统之家(www.xitongzhijia.net) 版权所有 闽ICP备号-1
本站发布的系统与软件仅为个人学习测试使用,请在下载后24小时内删除,不得用于任何商业用途,否则后果自负,请支持购买微软正版软件!
如侵犯到您的权益,请及时通知我们,我们会及时处理。ubuntu用户及密码的增加和删除
1:增加一个swift用户:
sudo useradd -mk /home/swift -s
/bin/bash swift
为swift用户添加密码:
sudo passwd swift
2:删除一个用户:
userdel swift
3:设置ROOT密码方法:
sudo passwd root
,然后输入密码即可!&&& //
此方法仅针对root密码尚未设置的情况下
修改root密码的方法:sudo passwd root
进入root状态.命令: su root 然后输入你设置好的密码就OK了
修改普通用户密码方法:passwd username
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。USERADD(8)
USERADD(8)
useradd - Create a new user or update default new user information
useradd [options] LOGIN
useradd -D
useradd -D [options]
DESCRIPTION
Creating New Users
When invoked without the -D option, the useradd command creates a new
user account using the values specified on the command line and the
default values from the system. Depending on command line options, the
useradd command will update system files and may also create the new
user’s home directory and copy initial files. The version provided with
Red Hat Linux will create a group for each user added to the system by
The options which apply to the useradd command are:
-c, --comment COMMENT
Any text string. It is generally a short description of the
login, and is currently used as the field for the user’s full
-b, --base-dir BASE_DIR
The default base directory for the system if -d dir is not
specified.
BASE_DIR is concatenated with the account name to
define the home directory. If the -m option is not used,
base_dir must exist.
-d, --home HOME_DIR
The new user will be created using HOME_DIR as the value for the
user’s login directory. The default is to append the LOGIN name
to BASE_DIR and use that as the login directory name.
-e, --expiredate EXPIRE_DATE
The date on which the user account will be disabled. The date is
specified in the format YYYY-MM-DD.
-f, --inactive INACTIVE
The number of days after a password expires until the account is
permanently disabled. A value of 0 disables the account as soon
as the password has expired, and a value of -1 disables the
feature. The default value is -1.
-g, --gid GROUP
The group name or number of the user’s initial login group. The
group name must exist. A group number must refer to an already
existing group.
-G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
A list of supplementary groups which the user is also a member
of. Each group is separated from the next by a comma, with no
intervening whitespace. The groups are subject to the same
restrictions as the group given with the -g option. The default
is for the user to belong only to the initial group.
-h, --help
Display help message and exit.
The user’s home directory will not be created, even if the
system wide settings from /etc/login.defs is to create home
-m, --create-home
The user’s home directory will be created if it does not exist.
The files contained in skeleton_dir will be copied to the home
directory if the -k option is used, otherwise the files
contained in /etc/skel will be used instead. Any directories
contained in
skeleton_dir or /etc/skel will be created in the user’s home
directory as well. The -k option is only valid in conjunction
with the -m option. The default is to not create the directory
and to not copy any files.
Do not add the user to the last login log file. This is an
option added by Red Hat.
A group having the same name as the user being added to the
system will be created by default. This option will turn off
this Red Hat Linux specific behavior. When this option is used,
users by default will be placed in whatever group is specified
in /etc/default/useradd. If no default group is defined, group 1
will be used.
-K, --key KEY=VALUE
Overrides /etc/login.defs defaults (UID_MIN, UID_MAX, UMASK,
PASS_MAX_DAYS and others). For example: -K PASS_MAX_DAYS=-1 can
be used when creating system account to turn off password
ageing, even though system account has no password at all.
Multiple -K options can be specified, e.g.: -K UID_MIN=100 -K
UID_MAX=499
Note: -K UID_MIN=10,UID_MAX=499 doesn’t work yet.
-o, --non-unique
Allow create user account with duplicate (non-unique) UID.
-p, --password PASSWORD
The encrypted password, as returned by crypt(3). The default is
to disable the account.
This flag is used to create a system account. That is, a user
with a UID lower than the value of UID_MIN defined in
/etc/login.defs and whose password does not expire. Note that
useradd will not create a home directory for such an user,
regardless of the default setting in /etc/login.defs. You have
to specify -m option if you want a home directory for a system
account to be created. This is an option added by Red Hat
-s, --shell SHELL
The name of the user’s login shell. The default is to leave this
field blank, which causes the system to select the default login
-u, --uid UID
The numerical value of the user’s ID. This value must be unique,
unless the -o option is used. The value must be non-negative.
The default is to use the smallest ID value greater than 999 and
greater than every other user. Values between 0 and 999 are
typically reserved for system accounts.
Changing the default values
When invoked with the -D option, useradd will either display the
current default values, or update the default values from the command
line. The valid options are
-b home_dir
The initial path prefix for a new user’s home directory. The
user’s name will be affixed to the end of home to create the new
directory name if the -d option is not used when creating a new
-e expire_date
The date on which the user account is disabled.
-f inactive
The number of days after a password has expired before the
account will be disabled.
-g, --gid GROUP
The group name or ID for a new user’s initial group. The named
group must exist, and a numerical group ID must have an existing
-s, --shell SHELL
The name of the new user’s login shell. The named program will
be used for all future new user accounts.
If no options are specified, useradd displays the current default
The system administrator is responsible for placing the default user
files in the
This version of useradd was modified by Red Hat to suit Red Hat
user/group conventions.
/etc/skel/ directory.
You may not add a user to a NIS group. This must be performed on the
NIS server.
/etc/passwd
user account information
/etc/shadow
secure user account information
/etc/group
group account information
/etc/gshadow
secure group information
/etc/default/useradd
default information
/etc/login.defs
system-wide settings
/etc/skel/
directory containing default files
EXIT VALUES
The useadd command exits with the following values:
can’t update password file
invalid command syntax
invalid argument to option
uid already in use (and no -o)
specified group doesn’t exist
username already in use
can’t update group file
can’t create home directory
can’t create mail spool
chfn(1), chsh(1), passwd(1), crypt(3), groupadd(8), groupdel(8),
groupmod(8), userdel(8), usermod(8)
Julianne Frances Haugh (jockgrrl@)
08/03/2005
USERADD(8)
Man(1) output converted with博客访问: 126705
博文数量: 55
博客积分: 1231
博客等级: 少尉
技术积分: 946
注册时间:
-->软硬件结合的系统级开发工程师,带过团队,爱好心理学,哲学,艺术...偶像:达芬奇
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: LINUX
adduser 和 useradd 的区别
adduser命令的使用:
&&&&在使用adduser命令时,它会添加这个用户名,并创建和用户名名称相同的组名,并把这个用户名添加到自己的组里去,并在/home目录想创建和用户名同名的目录,并拷贝/etc/skel目录下的内容到/home/用户名/的目录下,并提示输入密码,并提示填写相关这个用户名的信息。
比如创建用户myadmin
# addusermyadmin&&&&&&&&& # 创建普通用户myadminAdding user 'myadmin' ...&&&&&&&& # 系统新建新用户myadminAdding new group 'myadmin'(1004) .&&&&&&& # 添加相关用户组myadminAdding new user 'myadmin'(1010) with group myadmin ...&&&&&& # 并把用户myadmin添加到myadmin组Creating home directory '/home/myadmin' ...&&&&&& # 在/home下创建这个用户的目录Copying files from '/etc/skel' ...&&&&&&& # 拷贝/etc/skel目录下的隐藏配置文件到/home/myadminEnter new UNIX password:&&&&&&&& # 输入新密码Retype new UNIX password:&&&&&&&& # 确认新密码passwd: password updated successfullyChanging the user information for myadminEnter the new value,or press ENTER for the default&&&&&& # 输入myadmin此用户的相关信息&Full Name []:&Room Number []:&Work Phone []:&Home Phone []:&Other []:Is the information correct? [y/N]
&&&&用adduser命令创建的是一个系统用户,可以用这个用户名来登陆系统。
&&&&要是删除由adduser命令创建的的用户,用以下命令:
# userdel -r myadmin&&&&&& # -r参数删除用户myadmin的同时,将其宿主目录和系统内与其相关的内容删除。
useradd命令的使用:
&&&&在使用命令useradd时,它会添加这个用户名,并创建和用户名相同的组名,但它并不在/home目录下创建基于用户名的目录,也不提示创建新的密码。
# useradd myadmin # 创建普通用户myadmin
&&&&用useradd命令创建的是一个普通用户,不能用这个用户名来登陆系统。
&&&&删除由useradd创建的用户
# userdel myadmin
阅读(2659) | 评论(2) | 转发(0) |
相关热门文章
给主人留下些什么吧!~~
wsxedcer: 我想问一下,你是在什么系统上面测试的啊,反正在RedHat 系列上,adduser 是useradd链接文件.....我用的是Ubuntu发行版操作系统!
我想问一下,你是在什么系统上面测试的啊,反正在RedHat 系列上,adduser 是useradd链接文件
请登录后评论。}

我要回帖

更多关于 ubuntu 12.04 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信