solaris新增用户useradd命令使用时需注意-d参数



$ bash
bash-3.2$ df -kh
文件系统               大小   用了   可用 容量      挂接在
rpool/ROOT/s10x_u11wos_24a
                       547G  10.0G   502G     2%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                    57G   436K    57G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                       512G  10.0G   502G     2%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                    57G   496K    57G     1%    /tmp
swap                    57G    40K    57G     1%    /var/run
rpool/export           547G    32K   502G     1%    /export
mrpool/export/home     3.8T   196G   3.6T     6%    /export/home
mrpool                 3.8T    32K   3.6T     1%    /mrpool
mrpool/export          3.8T    31K   3.6T     1%    /mrpool/export
rpool                  547G    42K   502G     1%    /rpool

mrpool空间没人用,我需要在这个目录下新建一个用户。


bash-3.2$ su - root
口令: 
Generic January 2005
Sourcing //.profile-EIS.....
root@lnlte2dson # bash
Cm –s /usr/bin/sh Cm –s /usr/bin/sh sun
 –m –s /usr/bin/sh cdlftp –u 1233 –g omcg –d /mrpool –c "for large cdl file" 
 –m –s /usr/bin/sh cdlftp –u 1233 –g omcg –d /mrpool –c "for large cdl file" 
UX: useradd: ERROR: invalid syntax.
usage:  useradd [-u uid [-o] | -g group | -G group[[,group]...] |-d dir |
                -s shell | -c comment | -m [-k skel_dir] | -f inactive |
                -e expire | -A authorization [, authorization ...] |
                -P profile [, profile ...] | -R role [, role ...] |
                -K key=value | -p project [, project ...]] login
        useradd -D [-g group | -b base_dir | -f inactive | -e expire
                -A authorization [, authorization ...] |
                -P profile [, profile ...] | -R role [, role ...] |
                -K key=value ... -p project]
root@lnlte2dson # useradd –u 1233 –g omcg –d /mrpool –c "for large cdl file" –m –s /usr/bin/sh cdlftp
UX: useradd: ERROR: invalid syntax.
usage:  useradd [-u uid [-o] | -g group | -G group[[,group]...] |-d dir |
                -s shell | -c comment | -m [-k skel_dir] | -f inactive |
                -e expire | -A authorization [, authorization ...] |
                -P profile [, profile ...] | -R role [, role ...] |
                -K key=value | -p project [, project ...]] login
        useradd -D [-g group | -b base_dir | -f inactive | -e expire
                -A authorization [, authorization ...] |
                
root@lnlte2dson # useradd -u 1233 -g omcg -d /mrpool -c "for large cdl file" -m -s /usr/bin/sh cdlftp

好不容易敲对了命令的全部参数,——太长了。

可是发现创建的用户没有主目录,对比手册中的命令:

#useradd -u 1002 -g omcg -d /export/home/mrftp -m -s /bin/sh mrftp

发现,新建的路径名称是需要自己写。
root@lnlte2dson # passwd cdlftp
新口令: 
请重新输入新口令: 
passwd:cdlftp 的口令已成功更改
root@lnlte2dson # timed out waiting for input: auto-logout
root@lnlte2dson # bash   
root@lnlte2dson # userdel cdlftp

于是删除用户重新创建,注意-d /mrpool/cdlftp
root@lnlte2dson # useradd -u 1233 -g omcg -d /mrpool/cdlftp -c "for large cdl file" -m -s /usr/bin/sh cdlftp
root@lnlte2dson # passwd cdlftp
新口令: 
passwd: 口令位于历史记录列表中。
请再试一次
新口令: 
passwd: 口令位于历史记录列表中。
请再试一次
新口令: 
passwd: 口令位于历史记录列表中。
权限不够
root@lnlte2dson # passwd cdlftp
新口令: 
passwd: 口令位于历史记录列表中。
请再试一次
新口令: 
请重新输入新口令: 
passwd:cdlftp 的口令已成功更改
root@lnlte2dson # timed out waiting for input: auto-logout
root@lnlte2dson # bash

因为密码不能设上次用过的,但使用旧密码登录时提示登录失败次数过多而锁定账号,所以要解锁:
root@lnlte2dson # passwd -s cdlftp
cdlftp    LK    
root@lnlte2dson # passwd -u cdlftp
passwd:cdlftp 的口令信息更改
root@lnlte2dson # passwd -s cdlftp
cdlftp    PS    
root@lnlte2dson # pwd
/
root@lnlte2dson # cd etc/user_attr
bash: cd: etc/user_attr: 不是一个目录
root@lnlte2dson # cd etc

修改etc/user_attr文件,增加一行:cdlftp::::lock_after_retries=no,这样试错次数过多也不会锁定cdlftp账号了
root@lnlte2dson # vi user_attr
"user_attr" 13 行,424 字符 
#
# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
#
# /etc/user_attr
#
# user attributes. see user_attr(4)
#
#pragma ident   "@(#)user_attr 1.1      03/07/09 SMI"
#
adm::::profiles=Log Management
lp::::profiles=Printer Management
root::::auths=solaris.*,solaris.grant;profiles=Web Console Management,All;lock_a
fter_retries=no;min_label=admin_low;clearance=admin_high
omcrftp::::lock_after_retries=no
cdlftp::::lock_after_retries=no
~
~
~
~
~
~
~
~
"user_attr" 14 行,456 字符 
root@lnlte2dson # cat cdlftp
cat: 不能打开 cdlftp
root@lnlte2dson # cat user_attr
#
# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
#
# /etc/user_attr
#
# user attributes. see user_attr(4)
#
#pragma ident   "@(#)user_attr 1.1      03/07/09 SMI"
#
adm::::profiles=Log Management
lp::::profiles=Printer Management
root::::auths=solaris.*,solaris.grant;profiles=Web Console Management,All;lock_after_retries=no;min_label=admin_low;clearance=admin_high
omcrftp::::lock_after_retries=no
cdlftp::::lock_after_retries=no
root@lnlte2dson # timed out waiting for input: auto-logout
root@lnlte2dson # 
Logout umap.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值