zoukankan      html  css  js  c++  java
  • 指定用户的家目录不在/home

    1. 添加新用户时,修改用户的默认家目录/home,将/etc/default/useradd文件中的HOME替换为目标目录即可(红色字体所示)

    $ cat /etc/default/useradd

    # Default values for useradd(8)

    #

    # The SHELL variable specifies the default login shell on your

    # system.

    # Similar to DHSELL in adduser. However, we use "sh" here because

    # useradd is a low level utility and should be as general

    # as possible

    SHELL=/bin/sh

    #

    # The default group for users

    # 100=users on Debian systems

    # Same as USERS_GID in adduser

    # This argument is used when the -n flag is specified.

    # The default behavior (when -n and -g are not specified) is to create a

    # primary user group with the same name as the user being added to the

    # system.

    # GROUP=100

    #

    # The default home directory. Same as DHOME for adduser

    # HOME=/home    #更改为自己想指定的家目录,比如:/app/users

    2. 如果不更改useradd文件,可以通过选项-b来指定,

    $useradd -b /app/users -rms /bin/bash zhangsan

    相关选项参数:

    -c:加上备注文字,备注文字保存在passwd的备注栏中。 
    -d:指定用户登入时的启始目录。
    -D:变更预设值。
    -e:指定账号的有效期限,缺省表示永久有效。
    -f:指定在密码过期后多少天即关闭该账号。
    -g:指定用户所属的群组。
    -G:指定用户所属的附加群组。
    -m:自动建立用户的登入目录。
    -M:不要自动建立用户的登入目录。
    -n:取消建立以用户名称为名的群组。
    -r:建立系统账号。
    -s:指定用户登入后所使用的shell。
    -u:指定用户ID号。 #设定ID值时尽量要大于500,以免冲突。因为Linux安装后会建立一些特殊用户,一般0到499之间的值留给bin、mail这样的系统账号

    结束。

     

  • 相关阅读:
    art.dialog
    Asp.net中web.config配置文件详解
    Web.Config文件配置之限制上传文件大小和时间
    Asp.net中的一个判断session是否合法的做法
    js倒计时
    Asp.net中web.config配置文件详解
    C#调用耗时函数时显示进度条浅探
    ChannelFactory
    NetTcpBinding 类nettcpbinding的属性和方法
    n!的位数 斯特林公式
  • 原文地址:https://www.cnblogs.com/liusingbon/p/12874818.html
Copyright © 2011-2022 走看看