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

你可能感兴趣的:(ubuntu添加用户未指定shell,ll别名等无法是使用)