ubuntu添加用户未指定shell,ll别名等无法是使用

添加用户并指定shell:

    #useradd -r -m -s  /bin/bash test    #test为新增用户

    #passwd test  #修改用户密码

如果添加的时候未指定shelll可能没有创建用户目录和生成.bashrc文件。这时候就自己新建home目录和添加shell。

      #useradd test     #添加用户

      #passwd  test    #修改用户密码

      # mkdir /home/test  #创建用户目录

      #chown test:test  /home/test   #修改用户所属者

     这时候用户没有添加shell, echo $SHELL查看下。通过修改用户shell为/bin/bash

     #usermod -m /bin/bash  test

     如果没有/home/test/.bashrc文件,可以拷贝其他用户目录下的.bashrc文件。并修改所属者。

    # source ~/.bashrc   #使.bashrc文件立即生效

   

如果每次登录命令ll不可以使用,则配置需要添加.profile文件用来配置用户环境,可以从其他用户拷贝。内容如下:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.


# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022


# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi


# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值