vipw,vigr和vi的区别

vi

  • 编辑任意文件
  • 当文件以经被打开或者正在被编辑时,指示会提示,依然可以正常的修改和保存

vipw 编辑密码文件,并且上锁,其他人是无法修改成功的

  • vipw 会打开/etc/password文件,可以对其进行编辑

  • vipw -s :修改/etc/shadow文件

当删除用户出现如下错误的时候,可以使用以上两个命令将用户删除,


userdel: user test is currently used by process 23578

其他命令

Usage: vipw [options]

Options:
  -g, --group                   edit group database
  -h, --help                    display this help message and exit
  -p, --passwd                  edit passwd database
  -q, --quiet                   quiet mode
  -R, --root CHROOT_DIR         directory to chroot into
  -s, --shadow                  edit shadow or gshadow database

VIPW(8)                                        System Management Commands                                       VIPW(8)

NAME
       vipw, vigr - edit the password, group, shadow-password or shadow-group file

SYNOPSIS
       vipw [options]

       vigr [options]

DESCRIPTION
       The vipw and vigr commands edits the files /etc/passwd and /etc/group, respectively. With the -s flag, they will
       edit the shadow versions of those files, /etc/shadow and /etc/gshadow, respectively. The programs will set the
       appropriate locks to prevent file corruption. When looking for an editor, the programs will first try the
       environment variable $VISUAL, then the environment variable $EDITOR, and finally the default editor, vi(1).

OPTIONS
       The options which apply to the vipw and vigr commands are:

       -g, --group
           Edit group database.

       -h, --help
           Display help message and exit.

       -p, --passwd
           Edit passwd database.

       -q, --quiet
           Quiet mode.

       -R, --root CHROOT_DIR
           Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.

       -s, --shadow
           Edit shadow or gshadow database.

ENVIRONMENT
       VISUAL
           Editor to be used.

       EDITOR
           Editor to be used if VISUAL is not set.

FILES
       /etc/group
           Group account information.

选择使用什么编辑器打开

vigr 编辑用户组文件 ,并且上锁,其他人是无法修改成功的

  • vigr 修改/etc/groups文件
  • vigr -s 修改/etc/gshadow文件

Usage: vigr [options]

Options:
  -g, --group                   edit group database
  -h, --help                    display this help message and exit
  -p, --passwd                  edit passwd database
  -q, --quiet                   quiet mode
  -R, --root CHROOT_DIR         directory to chroot into
  -s, --shadow                  edit shadow or gshadow database


VIPW(8)                                        System Management Commands                                       VIPW(8)

NAME
       vipw, vigr - edit the password, group, shadow-password or shadow-group file

SYNOPSIS
       vipw [options]

       vigr [options]

DESCRIPTION
       The vipw and vigr commands edits the files /etc/passwd and /etc/group, respectively. With the -s flag, they will
       edit the shadow versions of those files, /etc/shadow and /etc/gshadow, respectively. The programs will set the
       appropriate locks to prevent file corruption. When looking for an editor, the programs will first try the
       environment variable $VISUAL, then the environment variable $EDITOR, and finally the default editor, vi(1).

OPTIONS
       The options which apply to the vipw and vigr commands are:

       -g, --group
           Edit group database.

       -h, --help
           Display help message and exit.

       -p, --passwd
           Edit passwd database.

       -q, --quiet
           Quiet mode.

       -R, --root CHROOT_DIR
           Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.

       -s, --shadow
           Edit shadow or gshadow database.

ENVIRONMENT
       VISUAL
           Editor to be used.

       EDITOR
           Editor to be used if VISUAL is not set.

FILES
       /etc/group
           Group account information.


posted @ 2018-12-20 10:52  随时静听  阅读(2143)  评论(0编辑  收藏  举报