【问题标题】:Does not add user in centOS 5.5在 centOS 5.5 中不添加用户
【发布时间】:2013-01-25 16:48:24
【问题描述】:

当我运行一个 shell 脚本时。它显示了一些错误。我在 centOS 5.5 上运行脚本。

这是我的 shell 脚本中显示错误的部分。

部分代码

if ! id service >/dev/null 2>&1
then
    doit 'CREATING "service" user' 'whereis adduser -c SERVICE -d /home/service -u 2000 -g 2000 -s /bin/bash service ; echo service | passwd --stdin service'
fi

doit 代码

doit ()
{
    local msg=$1
    shift
    if [ "$msg" ]
    then
        echo "$msg"
    fi
    if [ -z "$DONOTHING" ]
    then
        eval $*
    fi
}

错误

CREATING "service" user
adduser: /usr/sbin/adduser /usr/share/man/man8/adduser.8.gz
whereis [ -sbmu ] [ -SBM dir ... -f ] name...
passwd: Unknown user name 'service'.

【问题讨论】:

  • 你在doit做什么?
  • 正在尝试创建用户。
  • 你在做什么究竟?向我们展示代码。
  • 由于某些原因我无法显示代码。是的,我可以展示你想要的部分

标签: linux bash shell centos centos5


【解决方案1】:

我认为你只需要从你的命令中删除whereis

【讨论】:

  • 我也这样做....它显示CREATING "service" user *FILE LOCATION* adduser: command not found passwd: Unknown user name 'service'.
  • @FreakyCheeky 在$PATH 中是/usr/sbin/ 吗?
  • @FreakyCheeky 它需要在那里。
  • 告诉我如何解决这个错误。因为这是我脚本的第一步。
  • 他刚刚做到了。删除对 whois 的调用,并将 /usr/sbin 添加到 PATH。
猜你喜欢
  • 2019-01-29
  • 2015-07-03
  • 1970-01-01
  • 2014-10-23
  • 2012-05-20
  • 2011-03-25
  • 2015-04-13
  • 2011-05-25
  • 2012-03-18
相关资源
最近更新 更多